Perform alterations on field_attach_view() or field_view_field().
This hook is invoked after the field module has performed the operation.
$output: The structured content array tree for all of the entity's fields.
$context: An associative array containing:
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_field_attach_view_alter(&$output, $context) {
// Append RDF 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) {
$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'];
}
}
}
}
}