This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Form/SubmitButton.php

59 lines
1.2 KiB
PHP
Raw Normal View History

2012-12-31 14:29:36 +00:00
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form;
/**
* A button that submits the form.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class SubmitButton extends Button implements ClickableInterface
{
/**
2014-04-16 11:30:19 +01:00
* @var bool
2012-12-31 14:29:36 +00:00
*/
private $clicked = false;
/**
* {@inheritdoc}
*/
public function isClicked()
{
return $this->clicked;
}
/**
* Submits data to the button.
2012-12-31 14:29:36 +00:00
*
* @param string|null $submittedData The data
* @param bool $clearMissing Not used
2012-12-31 14:29:36 +00:00
*
* @return $this
2012-12-31 14:29:36 +00:00
*
* @throws Exception\AlreadySubmittedException if the form has already been submitted
2012-12-31 14:29:36 +00:00
*/
public function submit($submittedData, $clearMissing = true)
2012-12-31 14:29:36 +00:00
{
2017-09-18 16:34:11 +01:00
if ($this->getConfig()->getDisabled()) {
$this->clicked = false;
return $this;
}
parent::submit($submittedData, $clearMissing);
2012-12-31 14:29:36 +00:00
$this->clicked = null !== $submittedData;
return $this;
}
}