true,
'accept' => true,
'autofocus' => true,
'disabled' => true,
'form' => true,
'multiple' => true,
'required' => true,
'type' => true,
];
/**
* Render a form element from the provided $element
*
* @throws Exception\DomainException
*/
public function render(ElementInterface $element): string
{
$name = $element->getName();
if ($name === null || $name === '') {
throw new Exception\DomainException(sprintf(
'%s requires that the element has an assigned name; none discovered',
__METHOD__
));
}
$attributes = $element->getAttributes();
$attributes['type'] = $this->getType($element);
$attributes['name'] = $name;
if (array_key_exists('multiple', $attributes) && $attributes['multiple']) {
$attributes['name'] .= '[]';
}
$value = $element->getValue();
if (is_array($value) && isset($value['name']) && ! is_array($value['name'])) {
$attributes['value'] = $value['name'];
} elseif (is_string($value)) {
$attributes['value'] = $value;
}
return sprintf(
'createAttributesString($attributes),
$this->getInlineClosingBracket()
);
}
/**
* Determine input type to use
*/
protected function getType(ElementInterface $element): string
{
return 'file';
}
}