Habari\FormControlDropbutton::do_success PHP Method

do_success() public method

This control only executes its on_success callbacks when it was clicked
public do_success ( $form ) : boolean | string
return boolean | string A string to replace the rendering of the form with, or false
    public function do_success($form)
    {
        $actions = $this->get_setting('actions', array());
        if (isset($actions[$this->value])) {
            if (isset($actions[$this->value]['fn']) && is_callable($actions[$this->value]['fn'])) {
                $fn = $actions[$this->value]['fn'];
                call_user_func($fn, $form);
            } elseif (isset($actions[$this->value]['href']) && is_string(isset($actions[$this->value]['href']))) {
                Utils::redirect($actions[$this->value]['href'], true);
            }
        }
        return parent::do_success($form);
    }