summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-07-06 17:17:32 (GMT)
committerAlex Pott2014-07-06 17:17:32 (GMT)
commit36596e33c46e4eeb35d4a3f4d28932c116e45b05 (patch)
treee84830a4cd2e432b8f6818b2dd62261dec10b1c2
parent6a8faf5552ca30510e22ad4b784e17ae8cc8fa16 (diff)
Issue #2225965 by lokapujya, djevans | scor: Move taxonomy term RDFa markup inside title_suffix (similar to the edit and node markup).
-rw-r--r--core/modules/rdf/rdf.module27
1 files changed, 16 insertions, 11 deletions
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index e55510b..e62c538 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -526,22 +526,27 @@ function rdf_preprocess_comment(&$variables) {
* Implements hook_preprocess_HOOK() for taxonomy term templates.
*/
function rdf_preprocess_taxonomy_term(&$variables) {
+ // Adds RDFa markup to the taxonomy term container.
+ // The @about attribute specifies the URI of the resource described within
+ // the HTML element, while the @typeof attribute indicates its RDF type
+ // (e.g., schema:Thing, skos:Concept, and so on).
$term = $variables['term'];
$mapping = rdf_get_mapping('taxonomy_term', $term->bundle());
$bundle_mapping = $mapping->getPreparedBundleMapping();
+ $variables['attributes']['about'] = $term->url();
+ $variables['attributes']['typeof'] = empty($bundle_mapping['types']) ? NULL : $bundle_mapping['types'];
+
+ // Add RDFa markup for the taxonomy term name as metadata, if present.
$name_field_mapping = $mapping->getPreparedFieldMapping('name');
- // Adds the RDF type of the term and the term name in a <meta> tag.
- if (!empty($name_field_mapping)) {
- $term_label_meta = array(
- '#tag' => 'meta',
- '#attributes' => array(
- 'about' => url('taxonomy/term/' . $term->id()),
- 'typeof' => $bundle_mapping['types'],
- 'property' => $name_field_mapping['properties'],
- 'content' => $term->getName(),
- ),
+ if (!empty($name_field_mapping) && !empty($name_field_mapping['properties'])) {
+ $name_attributes = array(
+ 'property' => $name_field_mapping['properties'],
+ 'content' => $term->getName(),
+ );
+ $variables['title_suffix']['taxonomy_term_rdfa'] = array(
+ '#theme' => 'rdf_metadata',
+ '#metadata' => array($name_attributes),
);
- drupal_add_html_head($term_label_meta, 'rdf_term_label');
}
}