As I talked about in Microdata in Drupal: challenges for field formatters, microdata requires some specific code in field formatters for correct output. I will work on a patch to support this in Link.
I'm using the Entity Property API to find the parts that can be marked up, so the patch will depend on #1079782: support hook_entity_property_info()
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 1267662-microdata-11.patch | 8.47 KB | kim.pepper |
| #5 | 1267662-5-link_microdata_support.patch | 9.2 KB | kim.pepper |
Comments
Comment #1
Quarantine commentedSubscribing. Keep up the great work Lin!
Comment #2
dqdThanks Lin! Awesome!
... will be committed rapidly.
Comment #3
jherencia commentedJust for the record:
#1079782: support hook_entity_property_info()
Comment #4
colette commentedI wrote a patch fixing this issue as part of my Google Summer of Code project.
To test it, you can do the following:
Automated tests for this will be made available as part of the microdata module.
Comment #5
kim.pepperRe-rolled this against the latest 7.x-1.x branch.
I followed the steps as per above and can confirm it outputs valid microdata.
Kim
Comment #6
gittosj commentedTested - seems to work perfectly
Comment #7
kim.pepperComment #8
bryancasler commentedbump
Comment #9
jcfiala commentedClose, but not quite.
When I turned all this on and applied the patch, then link fields with a Title but no url come out as <span >TEXT</span>, which sort of breaks things.
Comment #9.0
jcfiala commentedChanged issue reference.
Comment #10
klonosComment #11
kim.pepperRe-roll
Comment #12
Anonymous (not verified) commentedThe patch in #11 applies cleanly against the current dev, & enables the desired functionality.
The problem mentioned at #9 did not present itself. The link field appears to require setting a URL whenever setting a title, & setting a title mapping with no URL mapping in the Microdata settings for the link field caused no problems either, in case that was what was meant.
RTBC.
Comment #15
Anonymous (not verified) commentedYes it does need work. After my post I discovered that this patch causes an undefined index warning.
Notice: Undefined index: microdata in theme_link_formatter_link_default() (line 1008 of /site/sites/all/modules/link/link.module).theme_link_formatter_link_default()has the following:$microdata = $vars['microdata'];But there is no microdata variable in the $vars array.
I further found that I could modify
in
link_theme()to get microdata into $vars, but it remains null.