Backend\Core\Engine\Form::addButton PHP Method

addButton() public method

Adds a button to the form
public addButton ( string $name, string $value, string $type = 'submit', string $class = null ) : SpoonFormButton
$name string Name of the button.
$value string The value (or label) that will be printed.
$type string The type of the button (submit is default).
$class string Class(es) that will be applied on the button.
return SpoonFormButton
    public function addButton($name, $value, $type = 'submit', $class = null)
    {
        $name = (string) $name;
        $value = (string) $value;
        $type = (string) $type;
        $class = $class !== null ? (string) $class : 'btn btn-primary';
        // do a check
        if ($type == 'submit' && $name == 'submit') {
            throw new Exception('You can\'t add buttons with the name submit. JS freaks out when we
                replace the buttons with a link and use that link to submit the form.');
        }
        // create and return a button
        return parent::addButton($name, $value, $type, $class);
    }