You are here

function hosting_client_menu in Hosting 5

Same name and namespace in other branches
  1. 6.2 client/hosting_client.module \hosting_client_menu()
  2. 7.4 client/hosting_client.module \hosting_client_menu()
  3. 7.3 client/hosting_client.module \hosting_client_menu()

Implementation of hook_menu()

File

client/hosting_client.module, line 417

Code

function hosting_client_menu($may_cache) {
  if (!$may_cache) {
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $node = node_load(arg(1));
      if ($node->type == 'client') {
        $site = new stdClass();
        $site->type = 'site';
        $site->client = arg(1);
        $items[] = array(
          'path' => 'node/' . $node->nid . '/site/add',
          'title' => t('Add site'),
          'description' => t('Add a site to the current client'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'site_node_form',
            $site,
          ),
          'access' => user_access('create site'),
          'type' => MENU_LOCAL_TASK,
          'weight' => 5,
        );
      }
    }
    $items[] = array(
      'path' => 'hosting_client/autocomplete',
      'title' => t('hosting client get client autocomplete'),
      'callback' => 'hosting_client_autocomplete',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
  }
  else {
    $items[] = array(
      'path' => 'admin/hosting/client',
      'title' => t('Clients'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'hosting_client_configure',
      'access' => user_access('administer clients') && hosting_feature('client'),
      'type' => MENU_LOCAL_TASK,
    );
  }
  return $items;
}