As part of my Google Summer of Code '12 project, I will extend the email field with microdata support.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

colette’s picture

Status: Active » Needs review
FileSize
2.21 KB

This patch should take care of the issue.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

I tested this patch and it works. The code does the following:

  • Chunk 3 ('microdata' => TRUE) enables the microdata UI in the field's instance settings form
  • Chunks 1 and 2 add a suggested mapping to that UI. This means users can choose to use the Schema.org term without having to look it up.
  • Chunks 4 and 5 deal with cases where the field formatter isn't meant to output machine readable info. In those cases, we unset the microdata mapping.

You can test this by:

  1. Adding an email field
  2. Entering email into the microdata "field properties" form field at the bottom
  3. Adding a node
  4. Copying the source to http://foolip.org/microdatajs/live/ ... When using the email_default or email_plain formatter, you should see an 'email' property with the email you entered as a value. When you are using the other two formatters, you shouldn't see any properties.

There are also automated tests for email/microdata integration that collette wrote and have been committed to microdata module. For the time being, we are putting all automated tests in the main microdata module.

mh86’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for the patch.
Most of it looks very clean. But I'm still wondering if there is a better way of handling the hidden email address field formatters, e.g. there is also the invisimail module that exposes a field formatter for the email field module, and maybe there are others I don't know of. Maybe we should do it the other way round: output the microdata only for the plain and mailto formatter and hide it for the rest. What do you think?

Anonymous’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community

Three years later, the patch still applies & adds the desired functionality. RTBC.