summaryrefslogtreecommitdiff
path: root/modules/rdf
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-10 14:23:32 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-10 14:23:32 +0000
commit61569498046f531db5d06ad48009d69c59ccd26b (patch)
tree1417066fb91a276f4c621e3ba9dc2cb3bcfa8c20 /modules/rdf
parent76cdb8547897a94978f979e9014d925ffe64c1c9 (diff)
downloadbrdo-61569498046f531db5d06ad48009d69c59ccd26b.tar.gz
brdo-61569498046f531db5d06ad48009d69c59ccd26b.tar.bz2
- Patch #566390 by Gábor Hojtsy, Jose Reyero: apply locale import protection to the plural forms.
Diffstat (limited to 'modules/rdf')
-rw-r--r--modules/rdf/rdf.module18
-rw-r--r--modules/rdf/rdf.test15
2 files changed, 33 insertions, 0 deletions
diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module
index 48e31c083..97d3c33bf 100644
--- a/modules/rdf/rdf.module
+++ b/modules/rdf/rdf.module
@@ -669,6 +669,24 @@ function rdf_preprocess_comment(&$variables) {
}
/**
+ * Implements MODULE_preprocess_HOOK().
+ */
+function rdf_preprocess_taxonomy_term(&$variables) {
+ // Adds the RDF type of the term and the term name in a meta tag.
+ $term = $variables['term'];
+ $term_label_meta = array(
+ '#tag' => 'meta',
+ '#attributes' => array(
+ 'about' => url('taxonomy/term/' . $term->tid),
+ 'typeof' => $term->rdf_mapping['rdftype'],
+ 'property' => $term->rdf_mapping['name']['predicates'],
+ 'content' => $term->name,
+ ),
+ );
+ drupal_add_html_head($term_label_meta, 'rdf_term_label');
+}
+
+/**
* Implements hook_field_attach_view_alter().
*/
function rdf_field_attach_view_alter(&$output, $context) {
diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test
index 5c487403a..85dac8970 100644
--- a/modules/rdf/rdf.test
+++ b/modules/rdf/rdf.test
@@ -332,6 +332,21 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase {
$author_about = $this->xpath("//a[@typeof='sioc:User' and @about='$account_uri' and @property='foaf:name' and contains(@xml:lang, '')]");
$this->assertTrue(!empty($author_about), t('RDFa markup found on author information on post. xml:lang on username is set to empty string.'));
}
+
+ /**
+ * Creates a random term and ensures the right RDFa markup is used.
+ */
+ function testTaxonomyTermRdfaAttributes() {
+ $vocabulary = TaxonomyWebTestCase::createVocabulary();
+ $term = TaxonomyWebTestCase::createTerm($vocabulary);
+
+ // Views the term and checks that the RDFa markup is correct.
+ $this->drupalGet('taxonomy/term/' . $term->tid);
+ $term_url = url('taxonomy/term/' . $term->tid);
+ $term_name = $term->name;
+ $term_rdfa_meta = $this->xpath("//meta[@typeof='skos:Concept' and @about='$term_url' and contains(@property, 'rdfs:label') and contains(@property, 'skos:prefLabel') and @content='$term_name']");
+ $this->assertTrue(!empty($term_rdfa_meta), t('RDFa markup found on term page.'));
+ }
}