You are here

function _rules_features_process_rule in Rules 6

Helper to recursively process all elements of a rule.

1 call to _rules_features_process_rule()
rules_features_process_rule in rules/rules.export.inc
Processes a rule and identifes needed components or dependencies.

File

rules/rules.export.inc, line 173
Provides export functionality and integrates with the features module.

Code

function _rules_features_process_rule($element, &$export, &$pipe) {
  if (isset($element['#type']) && isset($element['#name']) && ($module = rules_features_providing_module($element['#type'] . '_info', $element['#name']))) {
    $export['dependencies'][$module] = $module;
  }

  // Invoke the features_export callback if any.
  $element += array(
    '#settings' => array(),
  );
  rules_element_invoke($element, 'features_export', array(
    &$export,
    &$pipe,
    $element['#settings'],
    $element,
  ), FALSE);

  // Add used input evaluators.
  $element['#settings'] += array(
    '#eval input' => array(),
  );
  foreach ($element['#settings']['#eval input'] as $base => $info) {
    if ($module = rules_features_providing_module('evaluator', $base)) {
      $export['dependencies'][$module] = $module;
    }
  }

  // Recurse
  foreach (element_children($element) as $key) {
    _rules_features_process_rule((array) $element[$key], $export, $pipe);
  }
}