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

GoneIn20Seconds’s picture

Issue summary: View changes

Clarification of problem.

tanius’s picture

Issue summary: View changes

Proposed code change: change line 556 in modules/rdf/rdf.module from

$variables['item_attributes_array'][$delta] = rdf_rdfa_attributes($mapping[$field_name], $item);

to

$variables['item_attributes_array'][$delta] = array_merge(
  $variables['item_attributes_array'][$delta], 
  rdf_rdfa_attributes($mapping[$field_name], $item)
);

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".

Version: 7.21 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.