1.20.x actions.inc actions_get_info($action_name = NULL)

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

Parameters

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

Return value

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.

File

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,
          '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;
  }
}