Because the RDF type and about URI are added in hook_preprocess_node, they are not added to other entities. This means that for entities such as Field Collection, the RDFa will be incorrect. Since the typeof attribute is not set, any predicates set on the Field Collection will be parsed as predicates for the parent node instead.
This can be fixed with a small change to template_preprocess_entity. I will post a patch that gets part of the way there.
I'm hoping to include Field Collection in an article I'm writing about using RDF in Drupal for IBM developerWorks, but that article is due on Monday. If it's possible to get this change made to Entity before then, it would rock!
Comments
Comment #1
Anonymous (not verified) commentedOk, I think that this should do it.
It just adds the about and rdftype to the attributes array, which in turn adds these attributes to the containing div.
Comment #2
fagoMakes sense. I wrapped it into a module_exists('rdf') check, such that nothing is generated if RDF is disabled. Also I changed it to use the $uri variable already in place instead of $entity->uri - as this should continue to work even if entity_uri() internals change.
With that the RDFa output looks fine to me. However, still the field-collection - entity relation was not output, probably as there is no mapping for it. So does that work with rdfx then?
Thanks, committed.
>I'm hoping to include Field Collection in an article I'm writing about using RDF in Drupal for IBM developerWorks, but that article is due on Monday.
Sound great. I hope it's in time for you ;)
Comment #3
Anonymous (not verified) commentedThanks, it is in time, you are the best!!! Also, thanks for Field Collection, I had been wondering how we would do RDFa on field groupings, and Field Collection is perfect for that.