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.
Bug location
/modules/rdf/rdf.module:556
Problem
This line overwrites the render array value $variables['item_attributes_array'][$delta]. Any hook_preprocess_field() functions that alter the $variables['item_attributes_array'][$delta] and run before the rdf_preprocess_field() function will be overwritten if this line of code is run.
Workaround
Modify the weight of all modules that use hook_preprocess_field() to add values to $variables['item_attributes_array'][$delta] the to be greater than the RDF module's weight of zero (for Drupal core 7.21). See: How to update a module's weight
Comments
Comment #0.0
GoneIn20Seconds CreditAttribution: GoneIn20Seconds commentedClarification of problem.
Comment #1
tanius CreditAttribution: tanius commentedProposed code change: change line 556 in
modules/rdf/rdf.module
fromto
Fixed the issue for me on Drupal 7.34.
array_merge()
will overwrite an existing "property" attribute value with the one defined by the RDF module, but that seems right to me as all modules contributing previously have lower weight.I know, I still have to make this into a proper patch :) And a bit of SEO for those searching for the reason to their problems: "Drupal add item_attributes to body field", "Drupal item_attributes_array not working", "Drupal use item_attributes_array on body fields".