function rules_admin_get_grouped_labels in Rules 6
Gets an array of element labels grouped by modules
Parameters
$elements: An array of info elements, e.g. as returned from rules_get_events().
$key: The key for which the value is used for grouping the elements.
6 calls to rules_admin_get_grouped_labels()
- rules_admin_form_add_action in rules_admin/
rules_admin.rule_forms.inc - Returns the form for the first action add page
- rules_admin_form_add_condition in rules_admin/
rules_admin.rule_forms.inc - Returns the form for the first condition add page
- 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_admin_form_rule_settings in rules_admin/
rules_admin.rule_forms.inc - Returns the form for the settings of a rule
File
- rules_admin/
rules_admin.inc, line 65
Code
function rules_admin_get_grouped_labels($elements, $key = 'module') {
$grouped = array();
$ungrouped = array();
foreach (array_filter($elements, 'rules_admin_element_filter') as $name => $element) {
if (isset($element[$key])) {
$grouped[$element[$key]][$name] = rules_get_element_label($element);
}
else {
$ungrouped[$name] = rules_get_element_label($element);
}
}
foreach ($grouped as $name => $group) {
asort($grouped[$name]);
}
ksort($grouped);
asort($ungrouped);
return $ungrouped + $grouped;
}