rdf_rdfa_attributes
function rdf_rdfa_attributes
rdf_rdfa_attributes($mapping, $data = NULL)
Builds an array of RDFa attributes for a given mapping. This array will typically be passed through drupal_attributes() to create the attributes variables that are available to template files. These include $attributes, $title_attributes, $content_attributes and the field-specific $item_attributes variables. For more information, see theme_rdf_template_variable_wrapper().
Parameters
$mapping: An array containing a mandatory 'predicates' key and optional 'datatype', 'callback' and 'type' keys. For example:
array( 'predicates' => array('dc:created'), 'datatype' => 'xsd:dateTime', 'callback' => 'date_iso8601', ), );
$data: A value that needs to be converted by the provided callback function.
Return value
An array containing RDFa attributes suitable for drupal_attributes().
Related topics
File
- modules/rdf/rdf.module, line 307
- Enables semantically enriched output for Drupal sites in the form of RDFa.
Code
function rdf_rdfa_attributes($mapping, $data = NULL) { // The type of mapping defaults to 'property'. $type = isset($mapping['type']) ? $mapping['type'] : 'property'; switch ($type) { // The mapping expresses the relationship between two resources. case 'rel': case 'rev': $attributes[$type] = $mapping['predicates']; break; // The mapping expresses the relationship between a resource and some // literal text. case 'property': $attributes['property'] = $mapping['predicates']; // Convert $data to a specific format as per the callback function. if (isset($data) && isset($mapping['callback']) && function_exists($mapping['callback'])) { $callback = $mapping['callback']; $attributes['content'] = $callback($data); } if (isset($mapping['datatype'])) { $attributes['datatype'] = $mapping['datatype']; } break; } return $attributes; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!rdf!rdf.module/function/rdf_rdfa_attributes/7.x