PodsUI::callback_action PHP Method

callback_action() public method

Check for a custom action callback and run it (deprecated reverse arg order)
public callback_action ( ) : boolean | mixed
return boolean | mixed
    public function callback_action()
    {
        $args = func_get_args();
        if (empty($args)) {
            return false;
        }
        $action = array_shift($args);
        $deprecated = false;
        if (is_bool($action)) {
            $deprecated = $action;
            $action = array_shift($args);
        }
        // Do hook
        $callback_args = $args;
        array_unshift($callback_args, null);
        array_unshift($callback_args, 'action_' . $action);
        $callback = call_user_func_array(array($this, 'do_hook'), $callback_args);
        if (null === $callback) {
            $callback = false;
        }
        $args[] = $this;
        // Deprecated reverse arg order
        if ($deprecated) {
            $args = array_reverse($args);
        }
        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;
    }