Implements hook_field_attach_view_alter().
function rdf_field_attach_view_alter(&$output, $context) {
// Append term mappings on displayed taxonomy links.
foreach (element_children($output) as $field_name) {
$element =& $output[$field_name];
if ($element['#field_type'] == 'taxonomy_term_reference' && $element['#formatter'] == 'taxonomy_term_reference_link') {
foreach ($element['#items'] as $delta => $item) {
// This function is invoked during entity preview when taxonomy term
// reference items might contain free-tagging terms that do not exist
// yet and thus have no $item['taxonomy_term'].
if (isset($item['taxonomy_term'])) {
$term = $item['taxonomy_term'];
if (!empty($term->rdf_mapping['rdftype'])) {
$element[$delta]['#options']['attributes']['typeof'] = $term->rdf_mapping['rdftype'];
}
if (!empty($term->rdf_mapping['name']['predicates'])) {
$element[$delta]['#options']['attributes']['property'] = $term->rdf_mapping['name']['predicates'];
}
}
}
}
}
}