You are here

function nodewords_menu in Nodewords: D6 Meta Tags 5

Same name and namespace in other branches
  1. 6 nodewords.module \nodewords_menu()

Implementation of hook_menu().

File

./nodewords.module, line 92
Assign META tags to nodes, vocabularies, terms and pages.

Code

function nodewords_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'title' => t('Meta tags'),
      'path' => 'admin/content/nodewords',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'nodewords_settings_form',
      ),
      'description' => t('Configure HTML meta tags for all content.'),
      'access' => user_access('administer meta tags'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'title' => t('Settings'),
      'path' => 'admin/content/nodewords/global',
      'access' => user_access('administer meta tags'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'title' => t('Front page'),
      'path' => 'admin/content/nodewords/frontpage',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'nodewords_frontpage_form',
      ),
      'access' => user_access('administer meta tags'),
      'type' => MENU_LOCAL_TASK,
    );
  }
  else {
    $tags = nodewords_get();
    foreach ($tags as $name => $content) {
      if (!empty($content)) {
        drupal_set_html_head('<meta name="' . $name . '" content="' . $content . '" />');
      }
    }
  }
  return $items;
}