‪TYPO3CMS  11.5
ButtonViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
46 {
50  protected ‪$tagName = 'button';
51 
57  public function ‪initializeArguments()
58  {
59  parent::initializeArguments();
60  $this->registerTagAttribute(
61  'autofocus',
62  'string',
63  'Specifies that a button should automatically get focus when the page loads'
64  );
65  $this->registerTagAttribute(
66  'disabled',
67  'string',
68  'Specifies that the input element should be disabled when the page loads'
69  );
70  $this->registerTagAttribute('form', 'string', 'Specifies one or more forms the button belongs to');
71  $this->registerTagAttribute(
72  'formaction',
73  'string',
74  'Specifies where to send the form-data when a form is submitted. Only for type="submit"'
75  );
76  $this->registerTagAttribute(
77  'formenctype',
78  'string',
79  'Specifies how form-data should be encoded before sending it to a server. Only for type="submit" (e.g. "application/x-www-form-urlencoded", "multipart/form-data" or "text/plain")'
80  );
81  $this->registerTagAttribute(
82  'formmethod',
83  'string',
84  'Specifies how to send the form-data (which HTTP method to use). Only for type="submit" (e.g. "get" or "post")'
85  );
86  $this->registerTagAttribute(
87  'formnovalidate',
88  'string',
89  'Specifies that the form-data should not be validated on submission. Only for type="submit"'
90  );
91  $this->registerTagAttribute(
92  'formtarget',
93  'string',
94  'Specifies where to display the response after submitting the form. Only for type="submit" (e.g. "_blank", "_self", "_parent", "_top", "framename")'
95  );
96  $this->registerUniversalTagAttributes();
97  $this->registerArgument('type', 'string', 'Specifies the type of button (e.g. "button", "reset" or "submit")', false, 'submit');
98  }
99 
105  public function ‪render()
106  {
107  $type = $this->arguments['type'];
108  $name = $this->‪getName();
110 
111  $this->tag->addAttribute('type', $type);
112  $this->tag->addAttribute('name', $name);
113  $this->tag->addAttribute('value', $this->‪getValueAttribute());
114  $this->tag->setContent($this->renderChildren());
115  $this->tag->forceClosingTag(true);
116 
117  return $this->tag->render();
118  }
119 }
‪TYPO3\CMS\Fluid\ViewHelpers\Form
Definition: AbstractFormFieldViewHelper.php:16
‪TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper\render
‪string render()
Definition: ButtonViewHelper.php:104
‪TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper\$tagName
‪string $tagName
Definition: ButtonViewHelper.php:49
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper\registerFieldNameForFormTokenGeneration
‪registerFieldNameForFormTokenGeneration($fieldName)
Definition: AbstractFormViewHelper.php:106
‪TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper\initializeArguments
‪initializeArguments()
Definition: ButtonViewHelper.php:56
‪TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper
Definition: ButtonViewHelper.php:46
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper
Definition: AbstractFormFieldViewHelper.php:30
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\getName
‪string getName()
Definition: AbstractFormFieldViewHelper.php:90
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\getValueAttribute
‪mixed getValueAttribute()
Definition: AbstractFormFieldViewHelper.php:151