src/Yggdrasil/Utils/Templating/FormExtension.php
public function addButton(string $name): void
    {
        $options = $this->formOptions['fields'][$name];

        $button = HtmlTag::createElement('button')
            ->set('id', $name)
            ->set('type', $options['type'] ?? 'button')
            ->text($options['text'] ?? '');

        if (isset($options['text'])) {
            unset($options['text']);
        }

        foreach ($options as $attr => $value) {
            $button->set($attr, $value);
        }

        echo $button;
    }
public function addButton(string $name): void
    {
        $options = $this->formOptions['fields'][$name];

        $button = HtmlTag::createElement('button')
            ->set('id', $name)
            ->set('type', $options['type'] ?? 'button')
            ->text($options['text'] ?? '');

        if (isset($options['text'])) {
            unset($options['text']);
        }

        foreach ($options as $attr => $value) {
            $button->set($attr, $value);
        }

        echo $button;
    }
public function addButton ( string $ name ) : void { $ options = $ this -> formOptions [ 'fields' ] [ $ name ] ; $ button = HtmlTag :: createElement ( 'button' ) -> set ( 'id' , $ name ) -> set ( 'type' , $ options [ 'type' ] ?? 'button' ) -> text ( $ options [ 'text' ] ?? '' ) ; if ( isset ( $ options [ 'text' ] ) ) { unset ( $ options [ 'text' ] ) ; } foreach ( $ options as $ attr => $ value ) { $ button -> set ( $ attr , $ value ) ; } echo $ button ; }
Adds button to HTML form

@param string $name Button name, equivalent to ID attribute
Adds button to HTML form