57 parent::initializeArguments();
58 $this->
registerTagAttribute(
'disabled',
'string',
'Specifies that the input element should be disabled when the page loads');
59 $this->
registerArgument(
'errorClass',
'string',
'CSS class to set if there are errors for this view helper', FALSE,
'f3-form-error');
60 $this->
overrideArgument(
'value',
'string',
'Value of input tag. Required for checkboxes', TRUE);
73 public function render($checked = NULL, $multiple = NULL) {
74 $this->tag->addAttribute(
'type',
'checkbox');
76 $nameAttribute = $this->
getName();
85 if ($propertyValue instanceof \Traversable) {
86 $propertyValue = iterator_to_array($propertyValue);
88 if (is_array($propertyValue)) {
89 $propertyValue = array_map(array($this,
'convertToPlainValue'), $propertyValue);
90 if ($checked === NULL) {
91 $checked = in_array($valueAttribute, $propertyValue);
93 $nameAttribute .=
'[]';
94 } elseif ($multiple === TRUE) {
95 $nameAttribute .=
'[]';
96 } elseif ($checked === NULL && $propertyValue !== NULL) {
97 $checked = (bool)$propertyValue === (
bool)$valueAttribute;
101 $this->tag->addAttribute(
'name', $nameAttribute);
102 $this->tag->addAttribute(
'value', $valueAttribute);
104 $this->tag->addAttribute(
'checked',
'checked');
108 return $hiddenField . $this->tag->render();
registerTagAttribute($name, $type, $description, $required=FALSE, $default=NULL)
registerArgument($name, $type, $description, $required=FALSE, $defaultValue=NULL)
overrideArgument($name, $type, $description, $required=FALSE, $defaultValue=NULL)
registerUniversalTagAttributes()