You are here

function nodewords_og_og_description_form in Nodewords: D6 Meta Tags 6

File

nodewords_og/nodewords_og.module, line 372
OpenGraph support for Nodewords.

Code

function nodewords_og_og_description_form(&$form, $content, $options) {
  $autogenerate = FALSE;
  if ($options['type'] == NODEWORDS_TYPE_NODE && isset($options['node_type'])) {
    $autogenerate = variable_get('nodewords_metatags_generation_method_' . $options['node_type'], NODEWORDS_GENERATION_WHEN_EMPTY);
  }
  nodewords_og_form_default($form, $content, $options, 'og:description', 'textarea');
  $form['og:description']['#weight'] = -187;
  $form['og:description']['value']['#type'] = 'textarea';
  $form['og:description']['value']['#cols'] = 60;
  $form['og:description']['value']['#rows'] = 3;
  $form['og:description']['value']['#wysiwyg'] = FALSE;
  if ($options['type'] == NODEWORDS_TYPE_NODE) {
    if ($autogenerate == NODEWORDS_GENERATION_ALWAYS) {
      $form['og:description']['value']['#disabled'] = TRUE;
      $form['og:description']['value']['#rows'] = 1;
      $form['og:description']['value']['#default_value'] = '';
      $form['og:description']['value']['#description'] = t('This will be automatically generated from the node.');
    }
    elseif ($autogenerate == NODEWORDS_GENERATION_WHEN_EMPTY) {
      $form['og:description']['value']['#description'] .= ' ' . t('If this is left empty the value will be automatically generated from the node');
    }
  }

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

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