function autoassignrole_menu in Auto Assign Role 7.2
Same name and namespace in other branches
- 5.2 autoassignrole.module \autoassignrole_menu()
- 5 autoassignrole.module \autoassignrole_menu()
- 6.2 autoassignrole.module \autoassignrole_menu()
- 6 autoassignrole.module \autoassignrole_menu()
- 7 autoassignrole.module \autoassignrole_menu()
Implements hook_menu().
File
- ./
autoassignrole.module, line 38 - The main autoassignrole.module file
Code
function autoassignrole_menu() {
$items = array();
$items['admin/config/people/autoassignrole'] = array(
'title' => 'Auto assign role',
'description' => 'Configure auto role assignment.',
'access arguments' => array(
'administer autoassignrole',
),
'page callback' => 'autoassignrole_admin_block_page',
'file' => 'autoassignrole.admin.inc',
);
$items['admin/config/people/autoassignrole/auto'] = array(
'title' => 'Automatic',
'description' => 'Configure which role(s) are automatically assigned on user creation.',
'access arguments' => array(
'administer autoassignrole',
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'autoassignrole_auto_settings',
),
'file' => 'autoassignrole.admin.inc',
);
$items['admin/config/people/autoassignrole/user'] = array(
'title' => 'User choice',
'description' => 'Configure the ability for an end user to choose their own roles during registration.',
'access arguments' => array(
'administer autoassignrole',
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'autoassignrole_user_settings',
),
'file' => 'autoassignrole.admin.inc',
);
$items['admin/config/people/autoassignrole/pages'] = array(
'title' => 'Per Role Pages',
'description' => 'Configure individual pages to allow user to sign up for a particular role',
'access arguments' => array(
'administer autoassignrole',
),
'page callback' => 'autoassignrole_list_pages',
'file' => 'autoassignrole.admin.inc',
);
$items['admin/config/people/autoassignrole/pages/add'] = array(
'title' => 'Add Auto Assign Role Page',
'access arguments' => array(
'administer autoassignrole',
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'autoassignrole_page_form',
),
'type' => MENU_LOCAL_ACTION,
'file' => 'autoassignrole.admin.inc',
);
$items['admin/config/people/autoassignrole/pages/edit/%autoassignrole_page'] = array(
'title' => 'Edit Auto Assign Role Page',
'access arguments' => array(
'administer autoassignrole',
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'autoassignrole_page_form',
6,
),
'file' => 'autoassignrole.admin.inc',
);
$items['admin/config/people/autoassignrole/pages/delete/%autoassignrole_page'] = array(
'title' => 'Delete Auto Assign Role Page',
'access arguments' => array(
'administer autoassignrole',
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'autoassignrole_page_delete_confirm',
6,
'delete',
),
'file' => 'autoassignrole.admin.inc',
);
$items['admin/config/people/autoassignrole/pages/revert/%autoassignrole_page'] = array(
'title' => 'Revert Auto Assign Role Page',
'access arguments' => array(
'administer autoassignrole',
),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'autoassignrole_page_delete_confirm',
6,
'revert',
),
'file' => 'autoassignrole.admin.inc',
);
ctools_include('export');
$pages = ctools_export_crud_load_all('autoassignrole_page');
foreach ($pages as $page) {
$roles = drupal_map_assoc($page->roles);
switch ($page->display) {
case AUTOASSIGNROLE_PAGE_DISPLAY_STANDARD:
$items[$page->path] = array(
'title' => check_plain($page->title),
'page arguments' => array(
$roles,
),
'page callback' => 'autoassignrole_register',
'access callback' => 'user_register_access',
'file' => 'autoassignrole.paths.inc',
'type' => MENU_NORMAL_ITEM,
'menu_name' => $page->menu,
);
$items[$page->path . '/register'] = array(
'title' => 'Register',
'page arguments' => array(
$roles,
),
'page callback' => 'autoassignrole_register',
'access callback' => 'user_register_access',
'file' => 'autoassignrole.paths.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[$page->path . '/login'] = array(
'title' => 'Log In',
'page callback' => 'autoassignrole_login',
'access callback' => 'user_is_anonymous',
'file' => 'autoassignrole.paths.inc',
'type' => MENU_LOCAL_TASK,
);
$items[$page->path . '/password'] = array(
'title' => 'Request New Password',
'page callback' => 'autoassignrole_password',
'access callback' => 'user_is_anonymous',
'file' => 'autoassignrole.paths.inc',
'type' => MENU_LOCAL_TASK,
);
break;
case AUTOASSIGNROLE_PAGE_DISPLAY_INDIVIDUAL:
$items[$page->path] = array(
'title' => check_plain($page->title),
'page arguments' => array(
$roles,
),
'page callback' => 'autoassignrole_register',
'access callback' => 'user_register_access',
'file' => 'autoassignrole.paths.inc',
'type' => MENU_CALLBACK,
);
$items[$page->path . '/register'] = array(
'title' => 'Register',
'page arguments' => array(
$roles,
),
'page callback' => 'autoassignrole_register',
'access callback' => 'user_register_access',
'file' => 'autoassignrole.paths.inc',
'type' => MENU_CALLBACK,
);
$items[$page->path . '/login'] = array(
'title' => 'Log In',
'page callback' => 'autoassignrole_login',
'access callback' => 'user_is_anonymous',
'file' => 'autoassignrole.paths.inc',
'type' => MENU_CALLBACK,
);
$items[$page->path . '/password'] = array(
'title' => 'Request New Password',
'page callback' => 'autoassignrole_password',
'access callback' => 'user_is_anonymous',
'file' => 'autoassignrole.paths.inc',
'type' => MENU_CALLBACK,
);
break;
}
}
return $items;
}