true, 'autofocus' => true, 'disabled' => true, 'form' => true, 'formaction' => true, 'formenctype' => true, 'formmethod' => true, 'formnovalidate' => true, 'formtarget' => true, 'type' => true, 'value' => true, ); /** * Valid values for the button type * * @var array */ protected $validTypes = array( 'button' => true, 'reset' => true, 'submit' => true, ); /** * Invoke helper as functor * * Proxies to {@link render()}. * * @param ElementInterface|null $element * @param null|string $buttonContent * @return string|FormButton */ public function __invoke(ElementInterface $element = null, $buttonContent = null) { if (!$element) { return $this; } return $this->render($element, $buttonContent); } /** * Render a form '; } /** * Determine button type to use * * @param ElementInterface $element * @return string */ protected function getType(ElementInterface $element) { $type = $element->getAttribute('type'); if (empty($type)) { return 'submit'; } $type = strtolower($type); if (!isset($this->validTypes[$type])) { return 'submit'; } return $type; } }