You are here

function rules_admin_fix_breadcrumb in Rules 6

Fixes the breadcrumb on the rule edit/delete/revert

1 call to rules_admin_fix_breadcrumb()
rule_load in rules_admin/rules_admin.module
Loads the admin proxy of the rule with the given name

File

rules_admin/rules_admin.inc, line 352

Code

function rules_admin_fix_breadcrumb($rule, $name) {
  $crumbs = array();
  if (strpos($rule['#set'], 'event_') !== 0) {
    $crumbs[] = l(t('Rule sets'), RULES_ADMIN_SET_PATH);
    $set_info = rules_get_rule_sets($rule['#set']);
    $crumbs[] = l($set_info['label'], RULES_ADMIN_SET_PATH . '/' . $rule['#set']);
  }
  else {
    $crumbs[] = l(t('Triggered rules'), RULES_ADMIN_TRIGGER_PATH);
  }
  if (arg(5)) {

    // Also add a crumb to the rule itself.
    array_unshift($crumbs, l(t('Rules'), RULES_ADMIN_PATH));
    $crumbs[] = l($rule['#label'], RULES_ADMIN_RULE_PATH . '/' . $name);
  }
  rules_admin_add_crumbs($crumbs);
}