You are here

function _nodewords_prepare_description in Nodewords: D6 Meta Tags 6

Extract or generate the description for the current object.

Parameters

$tags: The array of tags currently generated.

$content: An array of settings for this current field, optionally including the manually assigned path.

$options: An array of options for this current page.

$tag_name: The name of the tag being generated.

Return value

The final string to be used for the description tag.

3 calls to _nodewords_prepare_description()
nodewords_basic_description_prepare in nodewords_basic/nodewords_basic.module
Set the meta tag content.
nodewords_extra_dc_description_prepare in nodewords_extra/nodewords_extra.module
Set the meta tag content.
nodewords_og_og_description_prepare in nodewords_og/nodewords_og.module

File

./nodewords.module, line 1625
Implement an API that other modules can use to implement meta tags.

Code

function _nodewords_prepare_description(&$tags, $content, $options, $tag_name) {

  // Will need this.
  if (!isset($content['value'])) {
    $content['value'] = '';
  }

  // If this is a node, try to load it then see if the description can or needs
  // to be automatically generated.
  if ($options['type'] == NODEWORDS_TYPE_NODE && ($node = node_load($options['id']))) {
    $autogenerate = variable_get('nodewords_metatags_generation_method_' . $node->type, NODEWORDS_GENERATION_WHEN_EMPTY);
    if ($autogenerate == NODEWORDS_GENERATION_ALWAYS || empty($content['value']) && $autogenerate == NODEWORDS_GENERATION_WHEN_EMPTY) {
      $content['value'] = nodewords_metatag_from_node_content($node, $content['value']);
    }
  }

  // Load the default if no value is present.
  if (empty($content['value']) && !empty($options['default'][$tag_name]['value'])) {
    $content['value'] = $options['default'][$tag_name]['value'];
  }
  $tags[$tag_name] = $content['value'];
}