function RulesUIController::config_menu

Generates menu items to manipulate rules configurations.

Parameters

string $base_path: The path to the overview page from where the configurations are edited.

File

ui/ui.controller.inc, line 25

Class

RulesUIController
Controller class for the Rules UI.

Code

public function config_menu($base_path) {
    $items = array();
    $base_count = count(explode('/', $base_path));
    $items[$base_path . '/manage/%rules_config'] = array(
        'title callback' => 'rules_get_title',
        'title arguments' => array(
            'Editing !plugin "!label"',
            $base_count + 1,
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_form_edit_rules_config',
            $base_count + 1,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'type' => MENU_VISIBLE_IN_BREADCRUMB,
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/add/%rules_element'] = array(
        // Adding another part to the path would hit the menu path-part-limit
        // for base paths like admin/config/workflow/rules. Therefore we have to
        // use this ugly way for setting the title.
'title callback' => 'rules_menu_add_element_title',
        // Wrap the integer in an array, so it is passed as is.
'title arguments' => array(
            array(
                $base_count + 4,
            ),
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_add_element',
            $base_count + 1,
            $base_count + 4,
            $base_count + 3,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'load arguments' => array(
            $base_count + 1,
        ),
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/add/event'] = array(
        'title callback' => 'rules_get_title',
        'title arguments' => array(
            'Adding event to !plugin "!label"',
            $base_count + 1,
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_add_event_page',
            $base_count + 1,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'load arguments' => array(
            $base_count + 1,
        ),
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/delete/event'] = array(
        // @todo Improve title.
'title' => 'Remove event',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_remove_event',
            $base_count + 1,
            $base_count + 4,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'description' => 'Remove an event from a reaction rule.',
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/edit/%rules_element'] = array(
        'title callback' => 'rules_get_title',
        'title arguments' => array(
            'Editing !plugin "!label"',
            $base_count + 3,
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_edit_element',
            $base_count + 1,
            $base_count + 3,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'load arguments' => array(
            $base_count + 1,
        ),
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/autocomplete'] = array(
        'page callback' => 'rules_ui_form_data_selection_auto_completion',
        'page arguments' => array(
            $base_count + 3,
            $base_count + 4,
            $base_count + 5,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'type' => MENU_CALLBACK,
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/delete/%rules_element'] = array(
        'title callback' => 'rules_get_title',
        'title arguments' => array(
            'Editing !plugin "!label"',
            $base_count + 3,
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_delete_element',
            $base_count + 1,
            $base_count + 3,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'load arguments' => array(
            $base_count + 1,
        ),
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/%'] = array(
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_form_rules_config_confirm_op',
            $base_count + 1,
            $base_count + 2,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/clone'] = array(
        'title callback' => 'rules_get_title',
        'title arguments' => array(
            'Cloning !plugin "!label"',
            $base_count + 1,
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_form_clone_rules_config',
            $base_count + 1,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/export'] = array(
        'title callback' => 'rules_get_title',
        'title arguments' => array(
            'Export of !plugin "!label"',
            $base_count + 1,
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_form_export_rules_config',
            $base_count + 1,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'view',
            $base_count + 1,
        ),
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    $items[$base_path . '/manage/%rules_config/execute'] = array(
        'title callback' => 'rules_get_title',
        'title arguments' => array(
            'Executing !plugin "!label"',
            $base_count + 1,
        ),
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
            'rules_ui_form_execute_rules_config',
            $base_count + 1,
            $base_path,
        ),
        'access callback' => 'rules_config_access',
        'access arguments' => array(
            'update',
            $base_count + 1,
        ),
        'file' => 'ui/ui.forms.inc',
        'file path' => drupal_get_path('module', 'rules'),
    );
    drupal_alter('rules_ui_menu', $items, $base_path, $base_count);
    if (module_exists('rules_scheduler')) {
        $items[$base_path . '/manage/%rules_config/schedule'] = array(
            'title callback' => 'rules_get_title',
            'title arguments' => array(
                'Schedule !plugin "!label"',
                $base_count + 1,
            ),
            'page callback' => 'drupal_get_form',
            'page arguments' => array(
                'rules_scheduler_schedule_form',
                $base_count + 1,
                $base_path,
            ),
            'access callback' => 'rules_config_access',
            'access arguments' => array(
                'update',
                $base_count + 1,
            ),
            'file' => 'rules_scheduler.admin.inc',
            'file path' => drupal_get_path('module', 'rules_scheduler'),
        );
    }
    return $items;
}