function drush_rules_list
Get a list of all rules.
File
-
./
rules.drush.inc, line 100
Code
function drush_rules_list() {
$rules = rules_config_load_multiple(FALSE);
$rows = array();
foreach ($rules as $rule) {
if (!empty($rule->name) && !empty($rule->label)) {
$events = array();
$event_info = rules_fetch_data('event_info');
if ($rule instanceof RulesTriggerableInterface) {
foreach ($rule->events() as $event_name) {
$event_info += array(
$event_name => array(
'label' => dt('Unknown event "!event_name"', array(
'!event_name' => $event_name,
)),
),
);
$events[] = check_plain($event_info[$event_name]['label']);
}
}
$rows[$rule->name] = array(
'rule' => $rule->name,
'label' => $rule->label,
'event' => implode(', ', $events),
'active' => $rule->active ? dt('Enabled') : dt('Disabled'),
'status' => $rule->status ? theme('entity_status', array(
'status' => $rule->status,
'html' => FALSE,
)) : '',
);
}
}
if (version_compare(DRUSH_VERSION, '6.0', '<')) {
drush_print_table($rows, TRUE);
}
return $rows;
}