You are here

function nodewords_extra_location_form in Nodewords: D6 Meta Tags 6

Same name and namespace in other branches
  1. 6.2 nodewords_extra/includes/nodewords_extra.nodewords.tags.inc \nodewords_extra_location_form()

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

File

nodewords_extra/nodewords_extra.module, line 554
Define extra meta tags for Drupal pages.

Code

function nodewords_extra_location_form(&$form, $content, $options) {
  $form['location'] = array(
    '#tree' => TRUE,
    '#weight' => -159,
  );
  $form['location']['latitude'] = array(
    '#type' => 'textfield',
    '#title' => t('Geotagging: Latitude'),
    '#default_value' => !empty($content['latitude']) ? $content['latitude'] : '',
    '#element_validate' => array(
      'nodewords_extra_location_latitude_form_validate',
    ),
    '#description' => t('Must be a number between -90.0 and 90.0 (extrems included). Used for the "geo.position" and "icbm" meta tags.'),
    '#size' => 14,
    '#maxlength' => 14,
    '#latitude' => TRUE,
  );
  $form['location']['longitude'] = array(
    '#type' => 'textfield',
    '#title' => t('Geotagging: Longitude'),
    '#default_value' => !empty($content['longitude']) ? $content['longitude'] : '',
    '#description' => t('Must be a number between -180.0 and 180.0 (extrems included). Used for the "geo.position" and "icbm" meta tags.'),
    '#size' => 14,
    '#element_validate' => array(
      'nodewords_extra_location_longitude_form_validate',
    ),
    '#maxlength' => 14,
  );

  // Show the current default.
  if ($options['type'] != NODEWORDS_TYPE_DEFAULT) {

    // Load the current defaults.
    if (!empty($options['default']['location']['latitude'])) {
      $latitude = $options['default']['location']['latitude'];
    }
    else {
      $latitude = t('Not set');
    }
    $form['location']['latitude']['#description'] .= '<br />' . t('The default is: %latitude', array(
      '%latitude' => $latitude,
    ));
    if (!empty($options['default']['location']['longitude'])) {
      $longitude = $options['default']['location']['longitude'];
    }
    else {
      $longitude = t('Not set');
    }
    $form['location']['longitude']['#description'] .= '<br />' . t('The defaults is: %longitude', array(
      '%longitude' => $longitude,
    ));
  }
}