You are here

function rules_fetch_data in Rules 7.2

Fetches module definitions for the given hook name.

Used for collecting events, rules, actions and condition from other modules.

Parameters

$hook: The hook of the definitions to get from invoking hook_rules_{$hook}.

15 calls to rules_fetch_data()
drush_rules_list in ./rules.drush.inc
Get a list of all rules.
RulesAbstractPlugin::rebuildCache in includes/rules.core.inc
Add in the data provided by the info hooks to the cache.
RulesContainerPluginUI::addOperations in ui/ui.core.inc
Gets the Add-* operations for the given element.
RulesDataProcessor::processors in includes/rules.processor.inc
Returns defined data processors applicable for the given parameter.
RulesEventSet::rebuildEventCache in includes/rules.plugins.inc
Rebuilds the event cache.

... See full list

1 string reference to 'rules_fetch_data'
rules_clear_cache in ./rules.module
Clears the rule set cache.

File

./rules.module, line 265
Rules engine module.

Code

function rules_fetch_data($hook) {
  $data =& drupal_static(__FUNCTION__, array());
  static $discover = array(
    'action_info' => 'RulesActionHandlerInterface',
    'condition_info' => 'RulesConditionHandlerInterface',
    'event_info' => 'RulesEventHandlerInterface',
  );
  if (!isset($data[$hook])) {
    $data[$hook] = array();
    foreach (module_implements('rules_' . $hook) as $module) {
      $result = call_user_func($module . '_rules_' . $hook);
      if (isset($result) && is_array($result)) {
        foreach ($result as $name => $item) {
          $item += array(
            'module' => $module,
          );
          $data[$hook][$name] = $item;
        }
      }
    }

    // Support class discovery.
    if (isset($discover[$hook])) {
      $data[$hook] += rules_discover_plugins($discover[$hook]);
    }
    drupal_alter('rules_' . $hook, $data[$hook]);
  }
  return $data[$hook];
}