TYPO3 CMS  TYPO3_8-7
PasswordViewHelper.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 
32 {
36  protected $tagName = 'input';
37 
43  public function initializeArguments()
44  {
45  parent::initializeArguments();
46  $this->registerTagAttribute(
47  'disabled',
48  'string',
49  'Specifies that the input element should be disabled when the page loads'
50  );
51  $this->registerTagAttribute(
52  'maxlength',
53  'int',
54  'The maxlength attribute of the input field (will not be validated)'
55  );
56  $this->registerTagAttribute('placeholder', 'string', 'The placeholder of the textfield');
57  $this->registerTagAttribute('readonly', 'string', 'The readonly attribute of the input field');
58  $this->registerTagAttribute('size', 'int', 'The size of the input field');
59  $this->registerArgument(
60  'errorClass',
61  'string',
62  'CSS class to set if there are errors for this view helper',
63  false,
64  'f3-form-error'
65  );
67  }
68 
75  public function render()
76  {
77  $name = $this->getName();
79  $this->setRespectSubmittedDataValue(true);
80 
81  $this->tag->addAttribute('type', 'password');
82  $this->tag->addAttribute('name', $name);
83  $this->tag->addAttribute('value', $this->getValueAttribute());
84 
86  $this->setErrorClassAttribute();
87 
88  return $this->tag->render();
89  }
90 }
registerTagAttribute($name, $type, $description, $required=false, $default=null)