You are here

function tagadelic_menu in Tagadelic 5

Same name and namespace in other branches
  1. 6 tagadelic.module \tagadelic_menu()
  2. 7 tagadelic.module \tagadelic_menu()

Implementation of hook_menu

File

./tagadelic.module, line 16

Code

function tagadelic_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/tagadelic',
      'title' => t('Tagadelic configuration'),
      'description' => t('Configure the tag clouds. Set the order, the number of tags, and the depth of the clouds.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'tagadelic_settings',
      'access' => user_access('administer site configuration'),
    );
    $items[] = array(
      'title' => t('Tags'),
      'path' => "tagadelic",
      'callback' => 'tagadelic_page_chunk',
      'access' => user_access('access content'),
      'type' => MENU_SUGGESTED_ITEM,
    );
    $items[] = array(
      'title' => t('Tags'),
      'path' => "tagadelic/list",
      'callback' => 'tagadelic_page_list',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    foreach (taxonomy_get_vocabularies($type = NULL) as $vocabulary) {
      $items[] = array(
        'title' => $vocabulary->name,
        'path' => "tagadelic/chunk/{$vocabulary->vid}",
        'callback' => 'tagadelic_page_chunk',
        'access' => user_access('access content'),
        'type' => MENU_SUGGESTED_ITEM,
      );
    }
  }
  else {

    // We put this in !$may_cache so it's only added once per request
    drupal_add_css(drupal_get_path('module', 'tagadelic') . '/tagadelic.css');
  }
  return $items;
}