You are here

function rules_admin_export_by_category in Rules 6

Adds in the rule items for the given tags.

4 calls to rules_admin_export_by_category()
rules_admin_form_export_submit in rules_admin/rules_admin.export.inc
rules_categories_features_export in rules/rules.export.inc
Implementation of hook_features_export() for categories.
rules_categories_features_export_render in rules/rules.export.inc
Implementation of hook_features_export_render() for categories.
rules_categories_features_revert in rules/rules.export.inc
Implementation of hook_features_revert() for rule categories.

File

rules_admin/rules_admin.export.inc, line 194

Code

function rules_admin_export_by_category(&$export, $tags_to_export = array()) {

  // Search all items for the given tag.
  foreach (rules_get_items() as $item_type => $info) {
    $items = array_filter(rules_get_configured_items($item_type), 'rules_admin_element_filter');
    foreach ($items as $name => $item) {
      $categories = isset($item['categories']) ? $item['categories'] : (isset($item['#categories']) ? $item['#categories'] : array());
      if (array_intersect($tags_to_export, $categories)) {
        $export[$item_type][$name] = $item;
      }
    }
  }
}