function nodewords_extra_location_prepare in Nodewords: D6 Meta Tags 6
Same name and namespace in other branches
- 6.2 nodewords_extra/includes/nodewords_extra.nodewords.tags.inc \nodewords_extra_location_prepare()
Set the meta tag content.
File
- nodewords_extra/
nodewords_extra.module, line 624 - Define extra meta tags for Drupal pages.
Code
function nodewords_extra_location_prepare(&$tags, $content, $options) {
// Load the defaults if at one or more of the lat/long values is invalid.
if (!isset($content['latitude']) || !is_numeric($content['latitude']) || !isset($content['longitude']) || !is_numeric($content['longitude'])) {
if (isset($options['default']['location']['latitude']) && is_numeric($options['default']['location']['latitude']) && isset($options['default']['location']['longitude']) && is_numeric($options['default']['location']['longitude'])) {
$content['latitude'] = $options['default']['location']['latitude'];
$content['longitude'] = $options['default']['location']['longitude'];
}
}
// Compile the output tag.
if (isset($content['latitude']) && is_numeric($content['latitude']) && isset($content['longitude']) && is_numeric($content['longitude'])) {
$tags['location:geo.position'] = $content['latitude'] . ';' . $content['longitude'];
$tags['location:icbm'] = $content['latitude'] . ',' . $content['longitude'];
}
// Optional Location.module integration.
// @TODO: Shouldn't this override existing data, rather than only be used if
// nothing was previously set?
$bool = empty($tags['location:geo.position']) && $options['type'] == NODEWORDS_TYPE_NODE && module_exists('location') && ($node = node_load($options['id'])) && isset($node->locations[0]['latitude']) && is_numeric($node->locations[0]['latitude']) && isset($node->locations[0]['longitude']) && is_numeric($node->locations[0]['longitude']);
if ($bool) {
$tags['location:geo.position'] = $node->locations[0]['latitude'] . ';' . $node->locations[0]['longitude'];
$tags['location:icbm'] = $node->locations[0]['latitude'] . ',' . $node->locations[0]['longitude'];
}
}