You are here

function rules_admin_get_categories in Rules 6

Returns an array of all existing categories

Parameters

$item_type: Either 'rules' or 'rule_sets'

Return value

An array of categories to use.

4 calls to rules_admin_get_categories()
rules_admin_categories_autocomplete in rules_admin/rules_admin.rule_forms.inc
Menu callback for the autocompletion of categories.
rules_admin_form_export in rules_admin/rules_admin.export.inc
Exports one or more configurations
rules_admin_form_overview in rules_admin/rules_admin.rule_forms.inc
Lists the available rules.
rules_categories_features_export_options in rules/rules.export.inc
Implementation of hook_features_export_options() for tags.

File

rules_admin/rules_admin.inc, line 208

Code

function rules_admin_get_categories($item_type) {
  $categories = array();
  foreach (array_filter(rules_get_configured_items($item_type), 'rules_admin_element_filter') as $item) {
    if ($item_type == 'rules' && isset($item['#categories']) && is_array($item['#categories'])) {
      $categories = $categories + drupal_map_assoc($item['#categories']);
    }
    if ($item_type == 'rule_sets' && isset($item['categories']) && is_array($item['categories'])) {
      $categories = $categories + drupal_map_assoc($item['categories']);
    }
  }
  return array_filter($categories);
}