You are here

public function ClientsConnectionEntityUIController::hook_menu in Web Service Clients 7.3

Provides definitions for implementing hook_menu().

Overrides ClientsHandlerEntityUIController::hook_menu

File

includes/clients.ui.inc, line 160
Provides a controller for building an entity overview form.

Class

ClientsConnectionEntityUIController
UI controller class for connections.

Code

public function hook_menu() {

  // Tweak what our base class does..
  $items = parent::hook_menu();
  $id_count = count(explode('/', $this->path));
  $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';

  // Create the base item for the Clients admin tabs...
  $base_item = $items[$this->path];
  $base_item['title'] = t('Clients');
  $base_item['type'] = MENU_NORMAL_ITEM;
  $items['admin/structure/clients'] = $base_item;

  // ... and turn the connections base item into the first tab.
  $items[$this->path]['title'] = t('Connections');
  $items[$this->path]['type'] = MENU_DEFAULT_LOCAL_TASK;

  // Testing system.
  $items[$this->path . '/manage/' . $wildcard . '/test'] = array(
    'title' => 'Test',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'clients_connection_test_form',
      $id_count + 1,
    ),
    'load arguments' => array(
      $this->entityType,
    ),
    'access arguments' => array(
      'administer clients connections',
    ),
    'file' => $this->entityInfo['admin ui']['file'],
    // Need to specify file path as this gets used in entity_menu().
    'file path' => drupal_get_path('module', $this->entityInfo['module']),
    'type' => MENU_LOCAL_TASK,
  );
  if (module_exists('devel')) {

    // Devel tab.
    $items[$this->path . '/manage/' . $wildcard . '/devel'] = array(
      'title' => 'Devel',
      'page callback' => 'clients_connection_page_devel',
      'page arguments' => array(
        $id_count + 1,
      ),
      'load arguments' => array(
        $this->entityType,
      ),
      'access arguments' => array(
        'administer clients connections',
      ),
      'file' => $this->entityInfo['admin ui']['file'],
      // Need to specify file path as this gets used in entity_menu().
      'file path' => drupal_get_path('module', $this->entityInfo['module']),
      'type' => MENU_LOCAL_TASK,
      'weight' => 10,
    );
  }
  return $items;
}