public function openTag($attributesOrElement = null)
    {
        if (null === $attributesOrElement) {
            return '<button>';
        }

        if (is_array($attributesOrElement)) {
            $attributes = $this->createAttributesString($attributesOrElement);

            return sprintf('<button %s>', $attributes);
        }

        if (!$attributesOrElement instanceof ElementInterface) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    '%s expects an array or Zend\Form\ElementInterface instance; received "%s"',
                    __METHOD__,
                    (is_object($attributesOrElement) ? get_class($attributesOrElement) :
                        gettype($attributesOrElement))
                )
            );
        }

        $element    = $attributesOrElement;
        $attributes = $element->getAttributes();
        $name       = $element->getName();

        if ($name) {
            $attributes['name'] = $name;
        }

        $attributes['type'] = $this->getType($element);
        $classList          = [
            'btn',
            'btn-white'
        ];

        /** @noinspection UnSafeIsSetOverArrayInspection */
        if (isset($attributes['class'])) {
            $attributes['class'] = implode(
                ' ', array_unique(array_merge(explode(' ', $attributes['class']), $classList))
            );
        } else {
            $attributes['class'] = implode(' ', $classList);
        }

        return sprintf(
            '<button %s>',
            $this->createAttributesString($attributes)
        );
    }
public function openTag($attributesOrElement = null)
    {
        if (null === $attributesOrElement) {
            return '<button>';
        }

        if (is_array($attributesOrElement)) {
            $attributes = $this->createAttributesString($attributesOrElement);

            return sprintf('<button %s>', $attributes);
        }

        if (!$attributesOrElement instanceof ElementInterface) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    '%s expects an array or Zend\Form\ElementInterface instance; received "%s"',
                    __METHOD__,
                    (is_object($attributesOrElement) ? get_class($attributesOrElement) :
                        gettype($attributesOrElement))
                )
            );
        }

        $element    = $attributesOrElement;
        $attributes = $element->getAttributes();
        $name       = $element->getName();

        if ($name) {
            $attributes['name'] = $name;
        }

        $attributes['type'] = $this->getType($element);
        $classList          = [
            'btn',
            'btn-white'
        ];

        /** @noinspection UnSafeIsSetOverArrayInspection */
        if (isset($attributes['class'])) {
            $attributes['class'] = implode(
                ' ', array_unique(array_merge(explode(' ', $attributes['class']), $classList))
            );
        } else {
            $attributes['class'] = implode(' ', $classList);
        }

        return sprintf(
            '<button %s>',
            $this->createAttributesString($attributes)
        );
    }
public function openTag ( $ attributesOrElement = null ) { if ( null === $ attributesOrElement ) { return '<button>' ; } if ( is_array ( $ attributesOrElement ) ) { $ attributes = $ this -> createAttributesString ( $ attributesOrElement ) ; return sprintf ( '<button %s>' , $ attributes ) ; } if ( ! $ attributesOrElement instanceof ElementInterface ) { throw new Exception \ InvalidArgumentException ( sprintf ( '%s expects an array or Zend\Form\ElementInterface instance; received "%s"' , __METHOD__ , ( is_object ( $ attributesOrElement ) ? get_class ( $ attributesOrElement ) : gettype ( $ attributesOrElement ) ) ) ) ; } $ element = $ attributesOrElement ; $ attributes = $ element -> getAttributes ( ) ; $ name = $ element -> getName ( ) ; if ( $ name ) { $ attributes [ 'name' ] = $ name ; } $ attributes [ 'type' ] = $ this -> getType ( $ element ) ; $ classList = [ 'btn' , 'btn-white' ] ; /** @noinspection UnSafeIsSetOverArrayInspection */ if ( isset ( $ attributes [ 'class' ] ) ) { $ attributes [ 'class' ] = implode ( ' ' , array_unique ( array_merge ( explode ( ' ' , $ attributes [ 'class' ] ) , $ classList ) ) ) ; } else { $ attributes [ 'class' ] = implode ( ' ' , $ classList ) ; } return sprintf ( '<button %s>' , $ this -> createAttributesString ( $ attributes ) ) ; }
Generate an opening button tag.

@param array|ElementInterface $attributesOrElement

@return string
@throws \Zend\Form\Exception\InvalidArgumentException
Generate an opening button tag .