public function OAuth2ServerScopeUIController::hook_menu in OAuth2 Server 7
Overrides EntityDefaultUIController::hook_menu().
Overrides EntityDefaultUIController::hook_menu
File
- includes/
oauth2_server.scope_admin.inc, line 26 - Admin UI for scopes.
Class
- OAuth2ServerScopeUIController
- UI controller.
Code
public function hook_menu() {
$items = array();
$path = 'admin/structure/oauth2-servers/manage/%/scopes';
$id_pos = count(explode('/', $path));
$items[$path] = array(
'title' => 'Scopes',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'oauth2_server_scope_overview_form',
'oauth2_server_scope',
),
'description' => 'Manage scopes.',
'access callback' => 'entity_access',
'access arguments' => array(
'view',
'oauth2_server_scope',
),
'type' => MENU_LOCAL_TASK,
'file' => 'includes/entity.ui.inc',
'weight' => 9,
);
$items[$path . '/add'] = array(
'title' => 'Add scope',
'page callback' => 'entity_ui_get_bundle_add_form',
'page arguments' => array(
'oauth2_server_scope',
4,
),
'access callback' => 'entity_access',
'access arguments' => array(
'create',
'oauth2_server_scope',
),
'type' => MENU_LOCAL_ACTION,
'file' => $this->entityInfo['admin ui']['file'],
'file path' => drupal_get_path('module', 'oauth2_server'),
);
// The regular Entity API way would be to use
// $path . '/manage/%entity_object' here, but Drupal's Menu API is limited
// to 9 levels, one too little for that to work.
$items[$path . '/%entity_object'] = array(
'title' => 'Edit',
'title callback' => 'entity_label',
'title arguments' => array(
'oauth2_server_scope',
$id_pos,
),
'page callback' => 'entity_ui_get_form',
'page arguments' => array(
'oauth2_server_scope',
$id_pos,
),
'load arguments' => array(
'oauth2_server_scope',
),
'access callback' => 'entity_access',
'access arguments' => array(
'update',
'oauth2_server_scope',
$id_pos,
),
'file' => $this->entityInfo['admin ui']['file'],
'file path' => drupal_get_path('module', 'oauth2_server'),
);
$items[$path . '/%entity_object/edit'] = array(
'title' => 'Edit',
'load arguments' => array(
'oauth2_server_scope',
),
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[$path . '/%entity_object/delete'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
'oauth2_server_scope_operation_form',
'oauth2_server_scope',
$id_pos,
'delete',
),
'load arguments' => array(
'oauth2_server_scope',
),
'access callback' => 'entity_access',
'access arguments' => array(
'delete',
'oauth2_server_scope',
$id_pos,
),
'file' => 'includes/entity.ui.inc',
);
return $items;
}