There has been a prominent announcement from Google, Yahoo, and Bing that they are going to support microdata for their http://schema.org vocabulary. While I believe they do intend to support RDFa for that as well at some point in the future, there seems to be some momentum behind microdata, so hopefully we can combine the RDF and microdata efforts to provide data interoperability to the widest range of consumers.
Entity referencing fields that are based on Entity API work perfectly for RDFa without modification. The field wrapper contains the attribute name and the output of the field formatter is used as the value. Unfortunately, because microdata requires that both the attribute name and value be included in the same tag, we need to make a minor modification for proper microdata Field Collection values.
I will attach a patch that includes support for the API in its current state. I don't recommend committing this until microdata module moves into RC, but I wanted this patch to be here so people could test.
Comment | File | Size | Author |
---|---|---|---|
#6 | 1199028-06-microdata.patch | 513 bytes | linclark |
#5 | 1199028-05-microdata.patch | 1.97 KB | linclark |
#3 | 1199028-03-microdata.patch | 1.05 KB | linclark |
#1 | 1199028-01-microdata.patch | 756 bytes | linclark |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedThis patch ensures that itemscope isn't placed on entities that are within fields.
Comment #2
tim.plunkettWill test soon. I *really* wish there was a
hook_field_formatter_view_alter()
!Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedUpdated for current API.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedI removed the microdata_top_level_item flag because it was too confusing.
Because the parent entity is available by reference, it's possible to pull the
itemprop
attribute that would normally go on the field wrapper. These are then combined with the item attributes for the Field Collection itself and added to the '#attributes' array.I'm feeling pretty comfortable with this pattern for reference fields. Please let me know if you have any comments or suggestions, I'm trying to work out all the remaining API WTFs now, before I move to beta.
The module isn't at RC yet, but I think I'm getting close to beta. I'll post here when it's in RC.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedThe modifications I made to Microdata module to support Views and Panels made reference fields super easy.
Here's the patch :)
Comment #7
dasjotried with the dev version of microdata.
when editing a field of a field_collection, i see a message with a link:
the link takes me to the field_collection manage fields page, where i don't see anything specific for microdata.
content types have an edit page, while field_collections don't
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedyeah, I would like to be able to have everything editable from the content type (or generically, the bundle) edit page.
However, since there isn't a bundle edit page for field_collection, you can go to admin/config/services/microdata and set it there. I haven't tested that UI lately, but it uses the same code so it should work.
Comment #9
dasjothanks for the pointer, didn't know about this UI :)
so i guess, either should the link point to the working UI or we ask field_collection to have an edit page as well
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedYeah, I'd be happy to have community feedback on the best way to handle this across different entity types.
Comment #11
klonosBesides doing actual code-review on the patch in #6, what need to be tested and confirmed as working (besides the obvious I mean)?