By inteja on
I don't have any language modules enabled at all.
But I'm getting an extra 'und' (which I gather means 'undefined language') level in the node object, only for the teaser. In the full view, there is no such extra array. So, to access a custom field value in my template I'm having to test for teaser and provide an alternative:
if ($teaser) {
$value = $node->my_custom_field['und'][0]['value'];
} else {
$value = $node->my_custom_field[0]['value'];
}
There seem to be quite a lot of forum posts and issues (against various modules) about this extra 'und' array cropping up, but no explanation as to why I'd be seeing this.
Am I missing something. Is this 'by design' or a bug?
Comments
I've encountered this too..
...but in my case, it's the other way around. That is, my teaser DOESN'T have it, but full node does. What gives?
Edit: I wonder if the fact that it IS on teaser and NOT on full node (or the other way around) depends on how the "Manage Display" screen is configured. In my case, "teaser" is the default view and "Full content" is the "custom" view. Just a thought.
It's never too late to have a happy childhood. ;-)