PodsUI::callback PHP Method

callback() public method

Check for a custom action callback and run it
public callback ( ) : boolean | mixed
return boolean | mixed
    public function callback()
    {
        $args = func_get_args();
        if (empty($args)) {
            return false;
        }
        $action = array_shift($args);
        // Do hook
        $callback_args = $args;
        array_unshift($callback_args, null);
        array_unshift($callback_args, $action);
        $callback = call_user_func_array(array($this, 'do_hook'), $callback_args);
        if (null === $callback) {
            $callback = false;
        }
        $args[] = $this;
        if (isset($this->actions_custom[$action])) {
            if (is_array($this->actions_custom[$action]) && isset($this->actions_custom[$action]['callback']) && is_callable($this->actions_custom[$action]['callback'])) {
                $callback = call_user_func_array($this->actions_custom[$action]['callback'], $args);
            } elseif (is_callable($this->actions_custom[$action])) {
                $callback = call_user_func_array($this->actions_custom[$action], $args);
            }
        }
        return $callback;
    }