You are here

function nodewords_settings_form in Nodewords: D6 Meta Tags 6

Same name and namespace in other branches
  1. 5 nodewords.module \nodewords_settings_form()

Menu callback: settings form.

3 string references to 'nodewords_settings_form'
nodewords_basic_keywords_settings_form in nodewords_basic/nodewords_basic.module
nodewords_basic_robots_settings_form in nodewords_basic/nodewords_basic.module
Set the form fields used to implement the options for the meta tag.
nodewords_menu in ./nodewords.module
Implements hook_menu().

File

./nodewords.admin.inc, line 250
Administration interface for nodewords.module.

Code

function nodewords_settings_form() {
  $edit_tags = variable_get('nodewords_edit', array());
  $form = array();
  $options = array();
  $tags_info = nodewords_get_possible_tags();
  if (!empty($tags_info)) {
    foreach ($tags_info as $name => $info) {
      $options[$name] = $info['label'];
    }
    uasort($options, 'strnatcmp');
  }
  $form['edit'] = array(
    '#type' => 'fieldset',
    '#title' => t('Meta tags to show on edit forms'),
    '#description' => t('Select the meta tags that appear on edit forms. Users with the "administer meta tags" permission can edit all meta tags, regardless of the follow.'),
    '#collapsible' => TRUE,
    '#group' => 'nodewords',
  );
  if (!empty($tags_info)) {
    $form['edit']['nodewords_edit'] = array(
      '#type' => 'checkboxes',
      '#options' => $options,
      '#default_value' => $edit_tags,
      '#checkall' => TRUE,
    );
  }
  else {
    $form['edit']['nodewords_edit'] = array(
      '#type' => 'value',
      '#value' => $edit_tags,
    );
  }
  $form['metatags_creation'] = array(
    '#type' => 'fieldset',
    '#title' => t('Meta tags creation options'),
    '#description' => t('These options change the way the meta tags are created.'),
    '#collapsible' => TRUE,
    '#group' => 'nodewords',
  );
  $form['metatags_creation']['nodewords_enable_user_metatags'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable the user profile meta tags'),
    '#default_value' => variable_get('nodewords_enable_user_metatags', TRUE),
  );
  $form['metatags_creation']['nodewords_list_repeat'] = array(
    '#type' => 'checkbox',
    '#title' => t('Repeat meta tags for lists'),
    '#description' => t('Some search engines punish sites that use the same meta tags on different pages. Uncheck this option if you want to suppress the repetition of the same meta tags on pages that use the pager - if unchecked, Drupal will only display the meta tags for the first page and not for subsequent pages. If unsure, select this option.'),
    '#default_value' => variable_get('nodewords_list_repeat', FALSE),
  );
  $form['metatags_creation']['nodewords_use_frontpage_tags'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use front page meta tags'),
    '#description' => t('Check this option if you want to use the <a href="@front-page-url" title="Meta tags for front page">meta tags for the front page</a> even if the <a href="@site-settings-url" title="Site information">default front page</a> specified is a view, panel or node - in this case, the meta tags specified for the view, panel or node will be ignored. If you want to use the meta tags of the view, panel or node instead, uncheck this option. If unsure, select this option and specify the meta tags you want on the <a href="@front-page-url" title="Meta tags for front page">meta tags for the front page</a>.', array(
      '@front-page-url' => url('admin/content/nodewords/meta-tags/frontpage'),
      '@site-settings-url' => url('admin/settings/site-information'),
    )),
    '#default_value' => variable_get('nodewords_use_frontpage_tags', TRUE),
  );
  $default_size = variable_get('nodewords_max_size', 350);
  $form['metatags_creation']['nodewords_max_size'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum meta tags length'),
    '#description' => t('The maximum length to use for the meta tags form fields.'),
    '#default_value' => $default_size,
    '#required' => TRUE,
    '#element_validate' => array(
      'nodewords_max_size_validate',
    ),
    '#size' => 6,
    '#maxlength' => 6,
  );
  if ($default_size < 350) {
    $form['metatags_creation']['nodewords_max_size']['#description'] .= ' ' . t('Google Search now uses the first 350 characters of the meta tag DESCRIPTION 350 characters, which is not the maximum length actually set for the meta tags. See <a href="@google-blog">Official Google Blog: Two new improvements to Google results pages</a> for more information.', array(
      '@google-blog' => 'http://googleblog.blogspot.com/2009/03/two-new-improvements-to-google-results.html',
    ));
  }
  $form['metatags_creation']['nodewords_base_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Base URL'),
    '#description' => t('Enter the base URL that will be used for any URL generated by the module.'),
    '#default_value' => variable_get('nodewords_base_url', ''),
    '#element_validate' => array(
      'nodewords_base_url_validate',
    ),
    '#size' => 60,
  );
  $form['metatags_creation']['nodewords_use_path_alias'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use URL aliases'),
    '#description' => t('By default URLs output in meta tags, e.g. the Canonical URL, will use the internal Drupal path, e.g. "node/123" and "taxonomy/term/123".  Enabling this option will instead make the URLs use the URL alias if one exists.  This option works best when the <a href="@url">GlobalRedirect</a> module is also used.', array(
      '@url' => 'http://drupal.org/project/globalredirect',
    )),
    '#default_value' => variable_get('nodewords_use_path_alias', TRUE),
  );
  foreach ($tags_info as $name => $info) {
    $function = $info['callback'] . '_settings_form';
    $options = array();
    if (function_exists($function)) {
      $function($form, 'nodewords_settings_form', $options);
    }
  }
  $form['#pre_render'][] = 'vertical_tabs_form_pre_render';
  $form = system_settings_form($form);
  $form['buttons']['#weight'] = 100;
  return $form;
}