summaryrefslogtreecommitdiff
path: root/modules/rdf
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-12-16 19:53:53 +0000
committerDries Buytaert <dries@buytaert.net>2009-12-16 19:53:53 +0000
commit8ee21dd13240614a65c3742e3439e7281de55dda (patch)
tree8a2147b65b37a25f3ddcfdf9f91080a92ef314cc /modules/rdf
parentc655cda6f31f4f423ff6b6efba12dcc1bd15376b (diff)
downloadbrdo-8ee21dd13240614a65c3742e3439e7281de55dda.tar.gz
brdo-8ee21dd13240614a65c3742e3439e7281de55dda.tar.bz2
- Patch #632092 by scor, linclark: number of replies of a node in RDFa.
Diffstat (limited to 'modules/rdf')
-rw-r--r--modules/rdf/rdf.module25
1 files changed, 24 insertions, 1 deletions
diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module
index 7993b24c7..73a2ec03a 100644
--- a/modules/rdf/rdf.module
+++ b/modules/rdf/rdf.module
@@ -405,7 +405,7 @@ function rdf_preprocess_node(&$variables) {
if (!empty($variables['node']->rdf_mapping['title']['predicates'])) {
$element['#attributes']['property'] = $variables['node']->rdf_mapping['title']['predicates'];
}
- drupal_add_html_head($element, 'rdf_node');
+ drupal_add_html_head($element, 'rdf_node_title');
}
// Adds RDFa markup for the date.
@@ -417,6 +417,29 @@ function rdf_preprocess_node(&$variables) {
if (!empty($variables['rdf_mapping']['uid'])) {
$variables['rdf_template_variable_attributes_array']['name']['rel'] = $variables['rdf_mapping']['uid']['predicates'];
}
+
+ // Adds RDFa markup annotating the number of comments a node has.
+ if (isset($variables['node']->comment_count) && !empty($variables['node']->rdf_mapping['comment_count']['predicates'])) {
+ // Annotates the 'x comments' link in teaser view.
+ if (isset($variables['content']['links']['comment']['#links']['comment_comments'])) {
+ $comment_count_attributes['property'] = $variables['node']->rdf_mapping['comment_count']['predicates'];
+ $comment_count_attributes['content'] = $variables['node']->comment_count;
+ $variables['content']['links']['comment']['#links']['comment_comments']['attributes'] += $comment_count_attributes;
+ }
+ // In full node view, the number of comments is not displayed by
+ // node.tpl.php so it is expressed in RDFa in the <head> tag.
+ if ($variables['page'] && user_access('access comments')) {
+ $element = array(
+ '#tag' => 'meta',
+ '#attributes' => array(
+ 'about' => $variables['node_url'],
+ 'property' => $variables['node']->rdf_mapping['comment_count']['predicates'],
+ 'content' => $variables['node']->comment_count,
+ ),
+ );
+ drupal_add_html_head($element, 'rdf_node_comment_count');
+ }
+ }
}
/**