You are here

function nodewords_basic_robots_form in Nodewords: D6 Meta Tags 6.3

Same name and namespace in other branches
  1. 6 nodewords_basic/nodewords_basic.module \nodewords_basic_robots_form()
  2. 6.2 nodewords_basic/includes/nodewords_basic.nodewords.tags.inc \nodewords_basic_robots_form()

Set the form fields used to implement the options for the meta tag.

File

nodewords_basic/includes/nodewords_basic.nodewords.tags.inc, line 227
Meta tags definition file.

Code

function nodewords_basic_robots_form(&$form, $content, $options) {
  $checkbox_options = array(
    'noarchive' => t('NOARCHIVE'),
    'noodp' => t('NOODP'),
    'nosnippet' => t('NOSNIPPET'),
    'noydir' => t('NOYDIR'),
  );
  $select_options = array(
    'index,follow' => 'INDEX,FOLLOW',
    'noindex,follow' => 'NOINDEX,FOLLOW',
    'index,nofollow' => 'INDEX,NOFOLLOW',
    'noindex,nofollow' => 'NOINDEX,NOFOLLOW',
  );
  if (isset($content['value']['noopd'])) {
    $content['value']['noodp'] = is_string($content['value']['noopd']) ? 'noodp' : 0;
    unset($content['value']['noopd']);
  }
  $form['robots'] = array(
    '#tree' => TRUE,
  );
  $form['robots']['index_follow'] = array(
    '#type' => 'select',
    '#title' => t('Robots'),
    '#options' => $select_options,
    '#multiple' => FALSE,
    '#default_value' => empty($content['index_follow']) ? 'noindex,nofollow' : $content['index_follow'],
  );
  $form['robots']['value'] = array(
    '#type' => 'checkboxes',
    '#description' => t("The meta tag ROBOTS, supported by several major search engines, controls whether search engine spiders are allowed to index a page, or not, and whether they should follow links from a page, or not. The meta tag can contain one or more comma-separate values. The <em>noindex</em> value prevents a page from being indexed, and <em>nofollow</em> prevents links from being crawled. Other values recognized by one or more search engines can influence how the engine indexes pages, and how those pages appear on the search results. These include <em>noarchive</em>, which instructs a search engine not to store an archived copy of the page, and <em>nosnippet</em>, which asks that the search engine not include a snippet from the page along with the page's listing in search results."),
    '#default_value' => empty($content['value']) ? array() : $content['value'],
    '#options' => $checkbox_options,
    '#checkall' => TRUE,
  );
}