45 parent::initializeArguments();
46 $this->registerTagAttribute(
'autofocus',
'string',
'Specifies that an input should automatically get focus when the page loads');
47 $this->registerTagAttribute(
'disabled',
'string',
'Specifies that the input element should be disabled when the page loads');
48 $this->registerTagAttribute(
'maxlength',
'int',
'The maxlength attribute of the input field (will not be validated)');
49 $this->registerTagAttribute(
'readonly',
'string',
'The readonly attribute of the input field');
50 $this->registerTagAttribute(
'size',
'int',
'The size of the input field');
51 $this->registerTagAttribute(
'placeholder',
'string',
'The placeholder of the textfield');
52 $this->registerTagAttribute(
'pattern',
'string',
'HTML5 validation pattern');
53 $this->registerArgument(
'errorClass',
'string',
'CSS class to set if there are errors for this ViewHelper',
false,
'f3-form-error');
54 $this->registerUniversalTagAttributes();
55 $this->registerArgument(
'required',
'bool',
'If the field is required or not',
false,
false);
56 $this->registerArgument(
'type',
'string',
'The field type, e.g. "text", "email", "url" etc.',
false,
'text');
66 $required = $this->arguments[
'required'] ??
false;
67 $type = $this->arguments[
'type'] ??
null;
73 $this->tag->addAttribute(
'type', $type);
74 $this->tag->addAttribute(
'name', $name);
78 if ($value !==
null) {
79 $this->tag->addAttribute(
'value', $value);
82 if ($required !==
false) {
83 $this->tag->addAttribute(
'required',
'required');
89 return $this->tag->render();