function template_preprocess_rdf_metadata
Same name in other branches
- 8.9.x core/modules/rdf/rdf.module \template_preprocess_rdf_metadata()
Prepares variables for RDF metadata templates.
Default template: rdf-metadata.html.twig.
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 hierarchy 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
array $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.
File
-
core/
modules/ rdf/ rdf.module, line 634
Code
function template_preprocess_rdf_metadata(&$variables) {
foreach ($variables['metadata'] as $key => $attributes) {
if (!is_null($attributes)) {
$variables['metadata'][$key] = new Attribute($attributes);
}
else {
$variables['metadata'][$key] = new Attribute();
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.