1

Using drupal's core RDF module there is a function (shown below) that add "xml:lang" attibute to tags. What I want to do is to change this functionality so that $variables['attributes_array']['xml:lang'] = 'en'; instead of leaving it blank like in the core module. What would be the best way to achieve this?

/*
 * 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'] = '';
  }
}
0

You can add the following preprocess function to template.php in your custom theme. The RDF module is preprocessing the variables used by the theme_username() function. Your custom theme can also preprocess these same variables and override the values set by the RDF module.

/*
 * Implements THEME_preprocess_HOOK().
 */  
function YOURTHEMENAME_preprocess_username(&$variables) {
  $variables['attributes_array']['xml:lang'] = 'en';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.