1 actions.inc actions_get_info($action_name = NULL)

Retrieves a single action's info by its name, or all actions

Parameters

string|null $action_name: (optional) The name of the action to retrieve.

Return value

array|false: An array of action info as provided by hook_action_info(). If no action name is specified, all actions in the system will be returned as an array keyed by the action name. If an action name is specified but not found, FALSE will be returned.

File

core/includes/actions.inc, line 43
This is the actions engine for executing stored actions.

Code

function actions_get_info($action_name = NULL) {
  $actions = &backdrop_static(__FUNCTION__);

  if (!isset($actions)) {
    foreach (module_implements('action_info') as $module) {
      $module_actions = module_invoke($module, 'action_info');
      foreach ($module_actions as $module_action_name => $action_info) {
        $action_info += array(
          'callback' => $module_action_name,
          // @todo In Backdrop 2.x, the default access callback should be
          // user_access() rather than TRUE, requiring always-available actions
          // to specify that they have no access check.
          'access callback' => TRUE,
          'access arguments' => array(),
          'module' => $module,
        );
        $actions[$module_action_name] = $action_info;
      }
    }
    backdrop_alter('action_info', $actions);
    backdrop_sort($actions);
  }

  if (!isset($action_name)) {
    return $actions;
  }
  elseif (isset($actions[$action_name])) {
    return $actions[$action_name];
  }
  else {
    return FALSE;
  }
}