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.

Files: 
CommentFileSizeAuthor
#6 1199028-06-microdata.patch513 byteslinclark
PASSED: [[SimpleTest]]: [MySQL] 78 pass(es).
[ View ]
#5 1199028-05-microdata.patch1.97 KBlinclark
PASSED: [[SimpleTest]]: [MySQL] 77 pass(es).
[ View ]
#3 1199028-03-microdata.patch1.05 KBlinclark
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1199028-03-microdata.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]
#1 1199028-01-microdata.patch756 byteslinclark
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1199028-01-microdata.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Comments

StatusFileSize
new756 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1199028-01-microdata.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

This patch ensures that itemscope isn't placed on entities that are within fields.

Status:Active» Needs review

Will test soon. I *really* wish there was a hook_field_formatter_view_alter()!

StatusFileSize
new1.05 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1199028-03-microdata.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Updated for current API.

Status:Needs review» Needs work

The last submitted patch, 1199028-03-microdata.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.97 KB
PASSED: [[SimpleTest]]: [MySQL] 77 pass(es).
[ View ]

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

StatusFileSize
new513 bytes
PASSED: [[SimpleTest]]: [MySQL] 78 pass(es).
[ View ]

The modifications I made to Microdata module to support Views and Panels made reference fields super easy.

Here's the patch :)

tried with the dev version of microdata.

when editing a field of a field_collection, i see a message with a link:

No itemtype has been defined for Field collection my_field. Define one on the Field collection my_field edit page.

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

yeah, 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.

thanks 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

Yeah, I'd be happy to have community feedback on the best way to handle this across different entity types.

Besides doing actual code-review on the patch in #6, what need to be tested and confirmed as working (besides the obvious I mean)?