You are here

public function OAuth2ServerClientUIController::hook_menu in OAuth2 Server 7

Overrides EntityDefaultUIController::hook_menu().

Overrides EntityDefaultUIController::hook_menu

File

includes/oauth2_server.client_admin.inc, line 26
Admin UI for clients.

Class

OAuth2ServerClientUIController
UI controller.

Code

public function hook_menu() {
  $items = array();
  $path = 'admin/structure/oauth2-servers/manage/%/clients';
  $id_pos = count(explode('/', $path));
  $items[$path] = array(
    'title' => 'Clients',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'oauth2_server_client_overview_form',
      'oauth2_server_client',
    ),
    'description' => 'Manage clients.',
    'access callback' => 'entity_access',
    'access arguments' => array(
      'view',
      'oauth2_server_client',
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'includes/entity.ui.inc',
    'weight' => 10,
  );
  $items[$path . '/add'] = array(
    'title' => 'Add client',
    'page callback' => 'entity_ui_get_bundle_add_form',
    'page arguments' => array(
      'oauth2_server_client',
      4,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'create',
      'oauth2_server_client',
    ),
    '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_client',
      $id_pos,
    ),
    'page callback' => 'entity_ui_get_form',
    'page arguments' => array(
      'oauth2_server_client',
      $id_pos,
    ),
    'load arguments' => array(
      'oauth2_server_client',
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'update',
      'oauth2_server_client',
      $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_client',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items[$path . '/%entity_object/delete'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'oauth2_server_client_operation_form',
      'oauth2_server_client',
      $id_pos,
      'delete',
    ),
    'load arguments' => array(
      'oauth2_server_client',
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'delete',
      'oauth2_server_client',
      $id_pos,
    ),
    'file' => 'includes/entity.ui.inc',
  );
  return $items;
}