summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-02-01 19:58:04 +0000
committerDries Buytaert <dries@buytaert.net>2010-02-01 19:58:04 +0000
commit83277eb32ce657a59dc7f6ee85c5964a0d567089 (patch)
tree62b57ccf1076da099cddebddc0c66893e34de926
parentf066e7f4e8dcdfb2f47523fa3b67f8d5fde199cd (diff)
downloadbrdo-83277eb32ce657a59dc7f6ee85c5964a0d567089.tar.gz
brdo-83277eb32ce657a59dc7f6ee85c5964a0d567089.tar.bz2
- Patch #681626 by linclark, scor: the username in RDF should not have a language tag.
-rw-r--r--modules/rdf/rdf.module9
-rw-r--r--modules/rdf/rdf.test14
2 files changed, 20 insertions, 3 deletions
diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module
index fb65a19f1..36d5b5b35 100644
--- a/modules/rdf/rdf.module
+++ b/modules/rdf/rdf.module
@@ -487,6 +487,15 @@ function rdf_preprocess_user_profile(&$variables) {
* Implements MODULE_preprocess_HOOK().
*/
function rdf_preprocess_username(&$variables) {
+ // Because xml:lang is set on the HTML element that wraps the page, the
+ // username inherits this language attribute. However, since the username
+ // might not be transliterated to the same language that the content is in,
+ // we do not want it to inherit the language attribute, so we set the
+ // attribute to an empty string.
+ if (empty($variables['attributes_array']['xml:lang'])) {
+ $variables['attributes_array']['xml:lang'] = '';
+ }
+
// $variables['account'] is a pseudo account object, and as such, does not
// contain the rdf mappings for the user; in the case of nodes and comments,
// it contains the mappings for the node or comment object instead. However
diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test
index 9f2a0fab5..3140ae02c 100644
--- a/modules/rdf/rdf.test
+++ b/modules/rdf/rdf.test
@@ -290,17 +290,25 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase {
/**
* Create a random user and ensure the default mapping for user is used.
*/
- function testUserProfilesAttributesInMarkup() {
+ function testUserAttributesInMarkup() {
// Create a user with access to user profiles.
$user = $this->drupalCreateUser(array('access user profiles'));
$this->drupalLogin($user);
// Browse to the user profile page.
$this->drupalGet('user/' . $user->uid);
- // Ensure the default bundle mapping for user is used. These attributes come
- // from the user default bundle definition.
+ // Ensure the default bundle mapping for user is used on the user profile
+ // page. These attributes come from the user default bundle definition.
$profile_url = url('user/' . $user->uid);
$user_profile_about = $this->xpath("//div[@class='profile' and @typeof='sioc:User' and @about='$profile_url']");
$this->assertTrue(!empty($user_profile_about), t('RDFa markup found on user profile page'));
+
+ // User creates node.
+ $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
+ $this->drupalGet('node/' . $node->nid);
+ // Ensures the default bundle mapping for user is used on the Authored By
+ // information on the node.
+ $author_about = $this->xpath("//a[@typeof='sioc:User' and @about='$profile_url' 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.'));
}
}