function theme_rdf_metadata
Returns HTML for a series of empty spans for exporting RDF metadata in RDFa.
Sometimes it is useful to export data which is not semantically present in the HTML output. For example, a hierarchy of comments is visible for a human but not for machines because this hiearchy is not present in the DOM tree. We can express it in RDFa via empty <span> tags. These aren't visible and give machines extra information about the content and its structure.
Parameters
$variables: An associative array containing:
- metadata: An array of attribute arrays. Each item in the array corresponds to its own set of attributes, and therefore, needs its own element.
See also
Related topics
2 theme calls to theme_rdf_metadata()
- rdf_preprocess_node in modules/
rdf/ rdf.module - Implements MODULE_preprocess_HOOK().
- rdf_process in modules/
rdf/ rdf.module - Template process function for adding extra tags to hold RDFa attributes.
File
-
modules/
rdf/ rdf.module, line 858
Code
function theme_rdf_metadata($variables) {
$output = '';
foreach ($variables['metadata'] as $attributes) {
// Add a class so that developers viewing the HTML source can see why there
// are empty <span> tags in the document.
$attributes['class'][] = 'rdf-meta';
$attributes['class'][] = 'element-hidden';
// The XHTML+RDFa doctype allows either <span></span> or <span /> syntax to
// be used, but for maximum browser compatibility, W3C recommends the
// former when serving pages using the text/html media type, see
// http://www.w3.org/TR/xhtml1/#C_3.
$output .= '<span' . drupal_attributes($attributes) . '></span>';
}
return $output;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.