You are here

function rules_admin_menu in Rules 6

Same name and namespace in other branches
  1. 7.2 rules_admin/rules_admin.module \rules_admin_menu()

Implementation of hook_menu().

File

rules_admin/rules_admin.module, line 32
Rules administration UI

Code

function rules_admin_menu() {
  $items = array();
  $items[RULES_ADMIN_PATH] = array(
    'title' => 'Rules',
    'description' => 'Rules administration links.',
    'position' => 'right',
    'weight' => 5,
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items[RULES_ADMIN_PATH . '/autocomplete'] = array(
    'page callback' => 'rules_admin_categories_autocomplete',
    'access arguments' => array(
      'administer rules',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'rules_admin.rule_forms.inc',
  );
  $items[RULES_ADMIN_TRIGGER_PATH] = array(
    'title' => 'Triggered rules',
    'description' => 'Customize your site by configuring rules that are evaluated on events.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_overview',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'type' => MENU_NORMAL_ITEM,
    'weight' => -2,
    'file' => 'rules_admin.rule_forms.inc',
  );
  $items[RULES_ADMIN_TRIGGER_PATH . '/list'] = array(
    'title' => 'Overview',
    'weight' => -5,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[RULES_ADMIN_TRIGGER_PATH . '/add'] = array(
    'title' => 'Add a new rule',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_add_rule',
      FALSE,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'rules_admin.rule_forms.inc',
  );
  foreach (rules_get_items() as $item_type => $info) {
    $items[RULES_ADMIN_PATH . '/' . $item_type . '/%rules_item/delete'] = array(
      'title' => 'Delete',
      'type' => MENU_CALLBACK,
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'rules_admin_item_form_delete',
        2,
        3,
      ),
      'access arguments' => array(
        'administer rules',
      ),
      'load arguments' => array(
        2,
      ),
      'file' => 'rules_admin.sets.inc',
    );
    $items[RULES_ADMIN_PATH . '/' . $item_type . '/%rules_item/revert'] = array(
      'title' => 'Revert',
      'type' => MENU_CALLBACK,
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'rules_admin_item_form_revert',
        2,
        3,
      ),
      'access arguments' => array(
        'administer rules',
      ),
      'load arguments' => array(
        2,
      ),
      'file' => 'rules_admin.sets.inc',
    );
  }
  $items[RULES_ADMIN_PATH . '/ie'] = array(
    'title' => 'Import / Export',
    'description' => 'Export your rules as text or import rules.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_export',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'rules_admin.export.inc',
    'weight' => 5,
    'type' => MENU_NORMAL_ITEM,
  );
  $items[RULES_ADMIN_PATH . '/ie/export'] = array(
    'title' => 'Export',
    'weight' => 0,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[RULES_ADMIN_PATH . '/ie/import'] = array(
    'title' => 'Import',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_import',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'weight' => 7,
    'type' => MENU_LOCAL_TASK,
    'file' => 'rules_admin.export.inc',
  );
  $items[RULES_ADMIN_PATH . '/settings'] = array(
    'title' => 'Settings',
    'description' => 'Set display options, show/hide Rules messages.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_settings',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'rules_admin.rule_forms.inc',
    'weight' => 7,
    'type' => MENU_NORMAL_ITEM,
  );

  //paths for modifing rules
  $items[RULES_ADMIN_RULE_PATH . '/%rule'] = array(
    'title callback' => 'rules_admin_rule_title',
    'title arguments' => array(
      'Editing rule @label',
      3,
    ),
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_edit_rule',
      3,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'rules_admin.rule_forms.inc',
  );
  $items[RULES_ADMIN_RULE_PATH . '/%rule/add'] = array(
    'title' => 'Add',
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_add',
      3,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'rules_admin.rule_forms.inc',
  );
  $items[RULES_ADMIN_RULE_PATH . '/%rule/edit/%rule_element'] = array(
    'title' => 'Edit',
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_edit',
      3,
      5,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'load arguments' => array(
      3,
    ),
    'file' => 'rules_admin.rule_forms.inc',
  );
  $items[RULES_ADMIN_RULE_PATH . '/%rule/delete/%rule_element'] = array(
    'title' => 'Delete',
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_delete',
      3,
      5,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'load arguments' => array(
      3,
    ),
    'file' => 'rules_admin.rule_forms.inc',
  );
  $items[RULES_ADMIN_RULE_PATH . '/%rule/clone'] = array(
    'title' => 'Clone rule',
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_clone',
      3,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'rules_admin.rule_forms.inc',
  );
  $items[RULES_ADMIN_SET_PATH] = array(
    'title' => 'Rule sets',
    'description' => 'Create and manage rule sets.',
    'page callback' => 'rules_admin_sets_overview',
    'access arguments' => array(
      'administer rules',
    ),
    'type' => MENU_NORMAL_ITEM,
    'weight' => 0,
    'file' => 'rules_admin.sets.inc',
  );
  $items[RULES_ADMIN_SET_PATH . '/list'] = array(
    'title' => 'Overview',
    'weight' => -5,
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[RULES_ADMIN_SET_PATH . '/add'] = array(
    'title' => 'Add a new rule set',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_add_rule_set',
      2,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'rules_admin.sets.inc',
    'weight' => 3,
  );
  $items[RULES_ADMIN_SET_PATH . '/js'] = array(
    'type' => MENU_CALLBACK,
    'page callback' => 'rules_admin_form_js',
    'page arguments' => array(
      'rules_admin_form_add_rule_set_add_arguments',
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'file' => 'rules_admin.sets.inc',
  );
  $items[RULES_ADMIN_SET_PATH . '/%rules_item'] = array(
    'type' => MENU_CALLBACK,
    'title callback' => 'rules_admin_item_title',
    'title arguments' => array(
      3,
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_edit_rule_set',
      3,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'load arguments' => array(
      2,
    ),
    'file' => 'rules_admin.sets.inc',
  );
  $items[RULES_ADMIN_SET_PATH . '/%rules_item/list'] = array(
    'title' => 'Overview',
    'weight' => -5,
    'load arguments' => array(
      2,
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[RULES_ADMIN_SET_PATH . '/%rules_item/add'] = array(
    'title' => 'Add a new rule',
    'type' => MENU_LOCAL_TASK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rules_admin_form_add_rule',
      3,
    ),
    'access arguments' => array(
      'administer rules',
    ),
    'load arguments' => array(
      2,
    ),
    'file' => 'rules_admin.rule_forms.inc',
  );
  return $items;
}