‪TYPO3CMS  9.5
ButtonViewHelper.php
Go to the documentation of this file.
1 <?php
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 
45 {
49  protected ‪$tagName = 'button';
50 
56  public function ‪initializeArguments()
57  {
58  parent::initializeArguments();
59  $this->registerTagAttribute(
60  'autofocus',
61  'string',
62  'Specifies that a button should automatically get focus when the page loads'
63  );
64  $this->registerTagAttribute(
65  'disabled',
66  'string',
67  'Specifies that the input element should be disabled when the page loads'
68  );
69  $this->registerTagAttribute('form', 'string', 'Specifies one or more forms the button belongs to');
70  $this->registerTagAttribute(
71  'formaction',
72  'string',
73  'Specifies where to send the form-data when a form is submitted. Only for type="submit"'
74  );
75  $this->registerTagAttribute(
76  'formenctype',
77  'string',
78  '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")'
79  );
80  $this->registerTagAttribute(
81  'formmethod',
82  'string',
83  'Specifies how to send the form-data (which HTTP method to use). Only for type="submit" (e.g. "get" or "post")'
84  );
85  $this->registerTagAttribute(
86  'formnovalidate',
87  'string',
88  'Specifies that the form-data should not be validated on submission. Only for type="submit"'
89  );
90  $this->registerTagAttribute(
91  'formtarget',
92  'string',
93  'Specifies where to display the response after submitting the form. Only for type="submit" (e.g. "_blank", "_self", "_parent", "_top", "framename")'
94  );
95  $this->registerUniversalTagAttributes();
96  $this->registerArgument('type', 'string', 'Specifies the type of button (e.g. "button", "reset" or "submit")', false, 'submit');
97  }
98 
104  public function ‪render()
105  {
106  $type = $this->arguments['type'];
107  $name = $this->‪getName();
109 
110  $this->tag->addAttribute('type', $type);
111  $this->tag->addAttribute('name', $name);
112  $this->tag->addAttribute('value', $this->‪getValueAttribute());
113  $this->tag->setContent($this->renderChildren());
114 
115  return $this->tag->render();
116  }
117 }
‪TYPO3\CMS\Fluid\ViewHelpers\Form
Definition: AbstractFormFieldViewHelper.php:2
‪TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper\render
‪string render()
Definition: ButtonViewHelper.php:103
‪TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper\$tagName
‪string $tagName
Definition: ButtonViewHelper.php:48
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper\registerFieldNameForFormTokenGeneration
‪registerFieldNameForFormTokenGeneration($fieldName)
Definition: AbstractFormViewHelper.php:101
‪TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper\initializeArguments
‪initializeArguments()
Definition: ButtonViewHelper.php:55
‪TYPO3\CMS\Fluid\ViewHelpers\Form\ButtonViewHelper
Definition: ButtonViewHelper.php:45
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper
Definition: AbstractFormFieldViewHelper.php:26
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\getName
‪string getName()
Definition: AbstractFormFieldViewHelper.php:86
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\getValueAttribute
‪mixed getValueAttribute()
Definition: AbstractFormFieldViewHelper.php:147