I use a German localized version of Drupal and on my installation the og:description tag was incorrectly populated. Instead of the body, the code filled the field with the title.
After a bit of debugging, I found out that this has to do with the language version.
In the file opengraph_meta.common.inc the function get_node_body($node) uses the default language index 'und'
return (!empty($node) && !empty($node->body) && !empty($node->body['und']['0']['value'])) ? $node->body['und']['0']['value'] : '';
Since I have a German-only version 'und' is not defined and this should be true for any other international version as well. I would have to access the following field to get the correct description.
$node->body['de']['0']['value']
However, this would not work for non-German version, so my proposal to fix this bug is:
return (!empty($node) && !empty($node->body) && !empty($node->body[$node->language]['0']['value'])) ? $node->body[$node->language]['0']['value'] : '';
The line above works fine for me, can someone test it with another language please?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1333554-opengraph_meta.common.inc_.patch | 810 bytes | toleillo |
Comments
Comment #1
toleillo commentedHi,
This patch works for me.
Comment #2
hiddentao commentedFixed in dev.
Comment #3
hiddentao commented@toleillo Thanks for the patch.
Comment #4
hiddentao commented