You are here

function nodewords_extra_dc_date_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_dc_date_form()

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

File

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

Code

function nodewords_extra_dc_date_form(&$form, $content, $options) {
  $form['dcterms.date'] = array(
    '#tree' => TRUE,
    '#weight' => -183,
  );
  $form['dcterms.date']['value'] = array(
    '#type' => 'date',
    '#title' => t('Dublin Core: Date'),
    '#description' => t('A point or period of time associated with an event in the lifecycle of the resource. The date should be relative to UTC.'),
    '#default_value' => empty($content['value']) ? array() : $content['value'],
  );

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

    // Load the current default.
    if (!empty($options['default']['dcterms.date']['value'])) {
      $date = $options['default']['dcterms.date']['value'];
      $default = format_date(mktime(0, 0, 0, $date['month'], $date['day'], $date['year']), 'custom', 'F jS, Y');
    }
    else {
      $default = t('Not set.');
    }
    $form['dcterms.date']['value']['#description'] .= '<br />' . t('The default is: %default', array(
      '%default' => $default,
    ));
  }
}