Closed (won't fix)
Project:
Nodewords: D6 Meta Tags
Version:
5.x-1.8
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 May 2008 at 16:10 UTC
Updated:
2 Jul 2009 at 17:15 UTC
Hi!
Thanks for useful module
To make it working with nodeteaser.module do a hack in /sites/all/modules/nodewords/metatags/description.inc
function nodewords_description_prepare($type, $ids, $value, $settings) {
if ((!isset($value) || empty($value)) && $settings['use_teaser'] && count($ids) == 1) {
switch ($type) {
case 'node':
$node = node_load($ids[0]);
if ($node && node_access('view', $node)) {
// HACK: see http://drupal.org/node/79315 (can't use php functions in
// body of nodes). Note that this still won't work if you have a
// CCK field with PHP format.
if (filter_format_allowcache($node->format)) {
// We would like to use node_view($node, TRUE, FALSE), unfortunately
// this uses theme_node() which, by default, adds 'Posted by ...'
// information (which we don't want). The code below calls all
// functions node_view() does, without the theme.
$node = node_build_content($node, TRUE, FALSE);
$content = drupal_render($node->content);
$node->teaser = $content;
node_invoke_nodeapi($node, 'alter', TRUE, FALSE);
$value = $node->teaser;
}
// Start of hack
elseif ($node->format!=2) {//Not PHP filter format
$node = node_build_content($node, TRUE, FALSE);
$content = drupal_render($node->content);
$node->teaser = $content;
node_invoke_nodeapi($node, 'alter', TRUE, FALSE);
$value = $node->teaser;
}
// End of hack
}
break;
case 'term':
// TODO: probably we have to do a db_rewrite_sql() query here so access is restricted
$term = taxonomy_get_term($ids[0]);
if ($term) {
$value = $term->description;
}
break;
case 'vocabulary':
// TODO: probably we have to do a db_rewrite_sql() query here so access is restricted
$voc = taxonomy_get_vocabulary($ids[0]);
if ($voc) {
$value = $voc->description;
}
break;
}
}
return $value;
}
Comments
Comment #1
avpadernoAs the Drupal 5 version is not supported anymore, I am changing the status of this report.