1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A button that submits the form.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class SubmitButton extends Button implements ClickableInterface
20{
21    /**
22     * @var bool
23     */
24    private $clicked = false;
25
26    /**
27     * {@inheritdoc}
28     */
29    public function isClicked()
30    {
31        return $this->clicked;
32    }
33
34    /**
35     * Submits data to the button.
36     *
37     * @param null|string $submittedData The data.
38     * @param bool        $clearMissing  Not used.
39     *
40     * @return SubmitButton The button instance
41     *
42     * @throws Exception\AlreadySubmittedException If the form has already been submitted.
43     */
44    public function submit($submittedData, $clearMissing = true)
45    {
46        parent::submit($submittedData, $clearMissing);
47
48        $this->clicked = null !== $submittedData;
49
50        return $this;
51    }
52}
53