TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ButtonViewHelper.php
Go to the documentation of this file.
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 
39 {
43  protected $tagName = 'button';
44 
52  public function initializeArguments()
53  {
54  parent::initializeArguments();
55  $this->registerTagAttribute(
56  'autofocus', 'string', 'Specifies that a button should automatically get focus when the page loads'
57  );
58  $this->registerTagAttribute(
59  'disabled', 'string', 'Specifies that the input element should be disabled when the page loads'
60  );
61  $this->registerTagAttribute('form', 'string', 'Specifies one or more forms the button belongs to');
62  $this->registerTagAttribute(
63  'formaction', 'string',
64  'Specifies where to send the form-data when a form is submitted. Only for type="submit"'
65  );
66  $this->registerTagAttribute(
67  'formenctype', 'string',
68  '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")'
69  );
70  $this->registerTagAttribute(
71  'formmethod', 'string',
72  'Specifies how to send the form-data (which HTTP method to use). Only for type="submit" (e.g. "get" or "post")'
73  );
74  $this->registerTagAttribute(
75  'formnovalidate', 'string',
76  'Specifies that the form-data should not be validated on submission. Only for type="submit"'
77  );
78  $this->registerTagAttribute(
79  'formtarget', 'string',
80  'Specifies where to display the response after submitting the form. Only for type="submit" (e.g. "_blank", "_self", "_parent", "_top", "framename")'
81  );
83  $this->registerArgument('type', 'string', 'Specifies the type of button (e.g. "button", "reset" or "submit")', false, 'submit');
84  }
85 
92  public function render()
93  {
94  $type = $this->arguments['type'];
95  $name = $this->getName();
97 
98  $this->tag->addAttribute('type', $type);
99  $this->tag->addAttribute('name', $name);
100  $this->tag->addAttribute('value', $this->getValueAttribute());
101  $this->tag->setContent($this->renderChildren());
102 
103  return $this->tag->render();
104  }
105 }
registerTagAttribute($name, $type, $description, $required=false, $default=null)