Habari\FormControl::do_success PHP Method

do_success() public method

Calls the success callback for the form, and saves the form value to the control's storage location
public do_success ( FormUI $form ) : boolean | string
$form FormUI The form this control belongs to
return boolean | string A string to replace the rendering of the form with, or false
    public function do_success($form)
    {
        $output = false;
        foreach ($this->on_success as $success) {
            $callback = array_shift($success);
            array_unshift($success, $this->get_form(), $this);
            if (!$form->get_setting('found_success', false)) {
                $result = Method::dispatch_array($callback, $success);
                if (is_string($result)) {
                    $output = $result;
                }
            }
        }
        $this->save();
        return $output;
    }