Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By jesse.d on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
- Adds rdf_entity_prepare_view() - loops over each defined rdf mapping for the entity in question, adding rdf data to the $item->_attributes property.
- Adds $item->_attributes property to field items.
- Removes rdf_preprocess_field() and rdf_field_attach_view_alter()
- As hook_entity_prepare_view() runs prior to markup being generated by field formatters, field formatters now have the option of using rdf attributes rather than having to wrap fields with rdf markup in template files.
- In the case that the field formatter does not do anything with the rdf _attributes passed to it, they will be added to fields in the same way they were in Drupal 7.
Drupal 8: Example of a field formatter using the item attributes directly in its output:
// Pass field item attributes to the theme function.
if (isset($item->_attributes)) {
$elements[$delta] += array('#attributes' => array());
$elements[$delta]['#attributes'] += $item->_attributes;
// Unset field item attributes since they have been included in the
// formatter output and should not be rendered in the field template.
unset($item->_attributes);
}
Impacts:
Module developers