You are here

function xmlsitemap_menu in XML sitemap 6

Same name and namespace in other branches
  1. 5.2 xmlsitemap/xmlsitemap.module \xmlsitemap_menu()
  2. 5 xmlsitemap.module \xmlsitemap_menu()
  3. 6.2 xmlsitemap.module \xmlsitemap_menu()
  4. 7.2 xmlsitemap.module \xmlsitemap_menu()

Implementation of hook_menu().

File

./xmlsitemap.module, line 116
Creates a sitemap compatible with the sitemaps.org schema.

Code

function xmlsitemap_menu() {
  $items = array();
  $access_config = array(
    'administer site configuration',
  );
  $access_content = array(
    'access content',
  );
  $items['admin/settings/xmlsitemap'] = array(
    'title' => 'XML sitemap',
    'description' => 'Configure the XML sitemap.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'xmlsitemap_settings',
    ),
    'access arguments' => $access_config,
    'file' => 'xmlsitemap.admin.inc',
  );
  $items['admin/settings/xmlsitemap/sitemap'] = array(
    'title' => 'Sitemap',
    'description' => 'Configure the XML sitemap.',
    'weight' => -1,
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file' => 'xmlsitemap.admin.inc',
  );
  $items['admin/settings/xmlsitemap/tools'] = array(
    'title' => 'Tools',
    'description' => 'Sitemap tools.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'xmlsitemap_tools',
    ),
    'access arguments' => $access_config,
    'type' => MENU_LOCAL_TASK,
    'file' => 'xmlsitemap.admin.inc',
  );
  $items['sitemap.xml'] = array(
    'title' => 'Sitemap index',
    'page callback' => 'xmlsitemap_output',
    'access arguments' => $access_content,
    'type' => MENU_CALLBACK,
    'file' => 'xmlsitemap.pages.inc',
  );
  $chunk_size = variable_get('xmlsitemap_chunk_size', XMLSITEMAP_DEFAULT_SITEMAP_LINKS);
  $link_count = xmlsitemap_link_count();
  if ($link_count > $chunk_size) {
    for ($chunk = 0; $chunk < $link_count / $chunk_size; ++$chunk) {
      $items["sitemap{$chunk}.xml"] = array(
        'title' => 'Sitemap !number',
        'title arguments' => array(
          '!number' => $chunk,
        ),
        'page callback' => 'xmlsitemap_output',
        'page arguments' => array(
          (string) $chunk,
        ),
        'access arguments' => $access_content,
        'type' => MENU_CALLBACK,
        'file' => 'xmlsitemap.pages.inc',
      );
    }
  }
  $items['sitemap.xsl'] = array(
    'page callback' => 'xmlsitemap_output_xsl',
    'access arguments' => $access_content,
    'type' => MENU_CALLBACK,
    'file' => 'xmlsitemap.pages.inc',
  );
  return $items;
}