TYPO3 CMS  TYPO3_7-6
ButtonViewHelper.php
Go to the documentation of this file.
1 <?php
2 
4 
5 /* *
6  * This script belongs to the FLOW3 package "TYPO3.Fluid". *
7  * *
8  * It is free software; you can redistribute it and/or modify it under *
9  * the terms of the GNU Lesser General Public License, either version 3 *
10  * of the License, or (at your option) any later version. *
11  * *
12  * The TYPO3 project - inspiring people to share! *
13  * */
14 
37 {
41  protected $tagName = 'button';
42 
49  public function initializeArguments()
50  {
51  parent::initializeArguments();
52  $this->registerTagAttribute(
53  'autofocus', 'string', 'Specifies that a button should automatically get focus when the page loads'
54  );
55  $this->registerTagAttribute(
56  'disabled', 'string', 'Specifies that the input element should be disabled when the page loads'
57  );
58  $this->registerTagAttribute('form', 'string', 'Specifies one or more forms the button belongs to');
59  $this->registerTagAttribute(
60  'formaction', 'string',
61  'Specifies where to send the form-data when a form is submitted. Only for type="submit"'
62  );
63  $this->registerTagAttribute(
64  'formenctype', 'string',
65  '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")'
66  );
67  $this->registerTagAttribute(
68  'formmethod', 'string',
69  'Specifies how to send the form-data (which HTTP method to use). Only for type="submit" (e.g. "get" or "post")'
70  );
71  $this->registerTagAttribute(
72  'formnovalidate', 'string',
73  'Specifies that the form-data should not be validated on submission. Only for type="submit"'
74  );
75  $this->registerTagAttribute(
76  'formtarget', 'string',
77  'Specifies where to display the response after submitting the form. Only for type="submit" (e.g. "_blank", "_self", "_parent", "_top", "framename")'
78  );
80  }
81 
89  public function render($type = 'submit')
90  {
91  $name = $this->getName();
93 
94  $this->tag->addAttribute('type', $type);
95  $this->tag->addAttribute('name', $name);
96  $this->tag->addAttribute('value', $this->getValueAttribute());
97  $this->tag->setContent($this->renderChildren());
98 
99  return $this->tag->render();
100  }
101 }
registerTagAttribute($name, $type, $description, $required=false, $default=null)