Commit 36596e33 authored by alexpott's avatar alexpott
Browse files

Issue #2225965 by lokapujya, djevans | scor: Move taxonomy term RDFa markup...

Issue #2225965 by lokapujya, djevans | scor: Move taxonomy term RDFa markup inside title_suffix (similar to the edit and node markup).
parent 6a8faf55
...@@ -526,22 +526,27 @@ function rdf_preprocess_comment(&$variables) { ...@@ -526,22 +526,27 @@ function rdf_preprocess_comment(&$variables) {
* Implements hook_preprocess_HOOK() for taxonomy term templates. * Implements hook_preprocess_HOOK() for taxonomy term templates.
*/ */
function rdf_preprocess_taxonomy_term(&$variables) { 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']; $term = $variables['term'];
$mapping = rdf_get_mapping('taxonomy_term', $term->bundle()); $mapping = rdf_get_mapping('taxonomy_term', $term->bundle());
$bundle_mapping = $mapping->getPreparedBundleMapping(); $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'); $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) && !empty($name_field_mapping['properties'])) {
if (!empty($name_field_mapping)) { $name_attributes = array(
$term_label_meta = array( 'property' => $name_field_mapping['properties'],
'#tag' => 'meta', 'content' => $term->getName(),
'#attributes' => array( );
'about' => url('taxonomy/term/' . $term->id()), $variables['title_suffix']['taxonomy_term_rdfa'] = array(
'typeof' => $bundle_mapping['types'], '#theme' => 'rdf_metadata',
'property' => $name_field_mapping['properties'], '#metadata' => array($name_attributes),
'content' => $term->getName(),
),
); );
drupal_add_html_head($term_label_meta, 'rdf_term_label');
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment