You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
136 lines
4.5 KiB
136 lines
4.5 KiB
4 years ago
|
<?php
|
||
|
|
||
|
/**
|
||
|
* @file
|
||
|
* Rules Admin User Interface.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* Implements hook_menu().
|
||
|
*/
|
||
|
function rules_admin_menu() {
|
||
|
// Reaction rules UI menu entries.
|
||
|
$reaction_path = 'admin/config/workflow/rules/reaction';
|
||
|
$items = rules_ui()->config_menu($reaction_path);
|
||
|
|
||
|
$items[$reaction_path] = array(
|
||
|
'title' => 'Rules',
|
||
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||
|
'weight' => -1,
|
||
|
);
|
||
|
$items[$reaction_path . '/add'] = array(
|
||
|
'title' => 'Add new rule',
|
||
|
'page callback' => 'drupal_get_form',
|
||
|
'page arguments' => array('rules_admin_add_reaction_rule', $reaction_path),
|
||
|
'access arguments' => array('administer rules'),
|
||
|
'type' => MENU_LOCAL_ACTION,
|
||
|
'file' => 'rules_admin.inc',
|
||
|
'weight' => 0,
|
||
|
);
|
||
|
$items[$reaction_path . '/import'] = array(
|
||
|
'title' => 'Import rule',
|
||
|
'page callback' => 'drupal_get_form',
|
||
|
'page arguments' => array('rules_ui_import_form', $reaction_path),
|
||
|
'access arguments' => array('administer rules'),
|
||
|
'file' => 'ui/ui.forms.inc',
|
||
|
'file path' => drupal_get_path('module', 'rules'),
|
||
|
'type' => MENU_LOCAL_ACTION,
|
||
|
);
|
||
|
|
||
|
// Components UI menu entries.
|
||
|
$component_path = 'admin/config/workflow/rules/components';
|
||
|
$items += rules_ui()->config_menu($component_path);
|
||
|
$items[$component_path] = array(
|
||
|
'title' => 'Components',
|
||
|
'page callback' => 'drupal_get_form',
|
||
|
'page arguments' => array('rules_admin_components_overview', $component_path),
|
||
|
'access arguments' => array('administer rules'),
|
||
|
'type' => MENU_LOCAL_TASK,
|
||
|
'file' => 'rules_admin.inc',
|
||
|
'weight' => 0,
|
||
|
);
|
||
|
$items[$component_path . '/add'] = array(
|
||
|
'title' => 'Add new component',
|
||
|
'page callback' => 'drupal_get_form',
|
||
|
'page arguments' => array('rules_admin_add_component', $component_path),
|
||
|
'access arguments' => array('administer rules'),
|
||
|
'type' => MENU_LOCAL_ACTION,
|
||
|
'file' => 'rules_admin.inc',
|
||
|
'weight' => 0,
|
||
|
);
|
||
|
$items[$component_path . '/import'] = array(
|
||
|
'title' => 'Import component',
|
||
|
'page callback' => 'drupal_get_form',
|
||
|
'page arguments' => array('rules_ui_import_form', $component_path),
|
||
|
'access arguments' => array('administer rules'),
|
||
|
'file' => 'ui/ui.forms.inc',
|
||
|
'file path' => drupal_get_path('module', 'rules'),
|
||
|
'type' => MENU_LOCAL_ACTION,
|
||
|
);
|
||
|
|
||
|
// Some general rules admin menu items.
|
||
|
$items['admin/config/workflow/rules'] = array(
|
||
|
'title' => 'Rules',
|
||
|
'position' => 'right',
|
||
|
'page callback' => 'drupal_get_form',
|
||
|
'page arguments' => array('rules_admin_reaction_overview', $reaction_path),
|
||
|
'description' => 'Manage reaction rules and rule components.',
|
||
|
'access arguments' => array('administer rules'),
|
||
|
'file' => 'rules_admin.inc',
|
||
|
);
|
||
|
$items['admin/config/workflow/rules/settings'] = array(
|
||
|
'title' => 'Settings',
|
||
|
'page callback' => 'drupal_get_form',
|
||
|
'page arguments' => array('rules_admin_settings'),
|
||
|
'access arguments' => array('administer rules'),
|
||
|
'type' => MENU_LOCAL_TASK,
|
||
|
'file' => 'rules_admin.inc',
|
||
|
'weight' => 1,
|
||
|
);
|
||
|
$items['admin/config/workflow/rules/settings/basic'] = array(
|
||
|
'title' => 'Basic',
|
||
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||
|
'weight' => -10,
|
||
|
);
|
||
|
$items['admin/config/workflow/rules/settings/advanced'] = array(
|
||
|
'title' => 'Advanced',
|
||
|
'type' => MENU_LOCAL_TASK,
|
||
|
'page callback' => 'drupal_get_form',
|
||
|
'page arguments' => array('rules_admin_settings_advanced'),
|
||
|
'access arguments' => array('administer rules'),
|
||
|
'file' => 'rules_admin.inc',
|
||
|
);
|
||
|
return $items;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Implements hook_form_alter().
|
||
|
*
|
||
|
* Since the overview forms are GET forms, we don't want them to send a wide
|
||
|
* variety of information. We need to use hook_form_alter() because the
|
||
|
* properties are added after form creation.
|
||
|
*/
|
||
|
function rules_admin_form_alter(&$form, &$form_state, $form_id) {
|
||
|
if ($form_id == 'rules_admin_reaction_overview' || $form_id == 'rules_admin_components_overview') {
|
||
|
$form['form_build_id']['#access'] = FALSE;
|
||
|
$form['form_token']['#access'] = FALSE;
|
||
|
$form['form_id']['#access'] = FALSE;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Implements hook_system_info_alter().
|
||
|
*
|
||
|
* Adds configuration links for Rules and Rules Scheduler in the modules list.
|
||
|
* (This is done by the Rules UI module, without which there would be no
|
||
|
* configuration pages to visit.)
|
||
|
*/
|
||
|
function rules_admin_system_info_alter(&$info, $file, $type) {
|
||
|
if ($file->name == 'rules') {
|
||
|
$info['configure'] = 'admin/config/workflow/rules';
|
||
|
}
|
||
|
if ($file->name == 'rules_scheduler') {
|
||
|
$info['configure'] = 'admin/config/workflow/rules/schedule';
|
||
|
}
|
||
|
}
|