[development] Question on hook_menu in cvs.

Metzler, David metzlerd at evergreen.edu
Wed Sep 20 16:54:51 UTC 2006


In the process of updating my cas module.  Having trouble implementing a
non-cachable "suggested" menu item.  

I've been working with this code and I can't get the non-cached entries
to show up in administer menus?  Anyone know if this is by design? Am I
taking the wrong approach here? 

Consider the following code snippet: 

function cas_menu($may_cache) {
  global $user;
  $items = array();

  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/cas',
      'title' => t('cas settings'),
      'description' => 'Configure central authentication services',
      'callback' => 'drupal_get_form',
      'callback arguments' => 'cas_admin_settings',
      'access' => user_access('administer cas'),
      'type' => MENU_NORMAL_ITEM,
      );
  }
  else
  {
    if ((!$user->uid) || ((arg(0)=='admin') && (arg(1) == 'build') &&
arg(2) == 'menu'))
    {
      drupal_set_message('loading menu array');
      $items[] = array(
       'path' => 'cas/login',
       'title' => t('CAS Login'),
       'callback' => 'cas_page',
       'access' => TRUE,
       'type' => MENU_SUGGESTED_ITEM,
       );
    }
  }
  return $items;
}



More information about the development mailing list