You are here

function xmlsitemap_settings_additional in XML sitemap 5

Menu callback; return additional links form.

Related topics

1 string reference to 'xmlsitemap_settings_additional'
xmlsitemap_menu in ./xmlsitemap.module
Implementation of hook_menu().

File

./xmlsitemap.module, line 177
Creates a site map compatible with the sitemaps.org schema.

Code

function xmlsitemap_settings_additional() {
  $form['xmlsitemap_additional_links_priority'] = array(
    '#type' => 'select',
    '#title' => t('Link priority'),
    '#default_value' => variable_get('xmlsitemap_additional_links_priority', 0.5),
    '#options' => xmlsitemap_priority_options(),
    '#description' => t('This is the default priority for additional links.'),
  );
  $form['delete']['#tree'] = TRUE;
  $form['path']['#tree'] = TRUE;
  $form['link']['#tree'] = TRUE;
  $form['link']['new'] = array(
    '#type' => 'textfield',
    '#size' => 40,
    '#description' => t('Enter a Drupal path to add to the site map.'),
    '#attributes' => array(
      'tabindex' => 1,
    ),
  );
  $form['old_priority']['#tree'] = TRUE;
  $form['priority']['#tree'] = TRUE;
  $form['priority']['new'] = array(
    '#type' => 'select',
    '#default_value' => 'NULL',
    '#options' => xmlsitemap_priority_options('default'),
    '#attributes' => array(
      'tabindex' => 2,
    ),
  );
  $result = pager_query("SELECT path, priority FROM {xmlsitemap_additional} ORDER BY last_changed DESC", 50);
  while ($link = db_fetch_object($result)) {
    $id = $link->path == 'new' ? '_new' : str_replace(array(
      '_',
      '%',
    ), array(
      '__',
      '_',
    ), urlencode($link->path));
    $form['delete'][$id] = array(
      '#type' => 'checkbox',
      '#default_value' => FALSE,
    );
    $form['path'][$id] = array(
      '#type' => 'value',
      '#value' => $link->path,
    );
    $form['link'][$id] = array(
      '#value' => l($link->path, $link->path),
    );
    $priority = isset($link->priority) ? $link->priority : 'NULL';
    $form['old_priority'][$id] = array(
      '#type' => 'value',
      '#value' => $priority,
    );
    $form['priority'][$id] = array(
      '#type' => 'select',
      '#default_value' => $priority,
      '#options' => xmlsitemap_priority_options('default'),
    );
  }
  $form['pager'] = array(
    '#value' => theme('pager', NULL, 50),
  );
  return system_settings_form($form);
}