[TASK] Streamline phpdoc annotations in EXT:fluid
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Form / SubmitViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Fluid\ViewHelpers\Form;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Creates a submit button.
19 *
20 * = Examples =
21 *
22 * <code title="Defaults">
23 * <f:form.submit value="Send Mail" />
24 * </code>
25 * <output>
26 * <input type="submit" />
27 * </output>
28 *
29 * <code title="Dummy content for template preview">
30 * <f:submit name="mySubmit" value="Send Mail"><button>dummy button</button></f:submit>
31 * </code>
32 * <output>
33 * <input type="submit" name="mySubmit" value="Send Mail" />
34 * </output>
35 */
36 class SubmitViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper
37 {
38 /**
39 * @var string
40 */
41 protected $tagName = 'input';
42
43 /**
44 * Initialize the arguments.
45 */
46 public function initializeArguments()
47 {
48 parent::initializeArguments();
49 $this->registerTagAttribute(
50 'disabled',
51 'string',
52 'Specifies that the input element should be disabled when the page loads'
53 );
54 $this->registerUniversalTagAttributes();
55 }
56
57 /**
58 * Renders the submit button.
59 *
60 * @return string
61 */
62 public function render()
63 {
64 $name = $this->getName();
65 $this->registerFieldNameForFormTokenGeneration($name);
66
67 $this->tag->addAttribute('type', 'submit');
68 $this->tag->addAttribute('value', $this->getValueAttribute());
69 if (!empty($name)) {
70 $this->tag->addAttribute('name', $name);
71 }
72
73 return $this->tag->render();
74 }
75 }