i18n

Drupal theming: Get field values in Drupal 7

Drupal 7 has another array structure for storing field values in $node. There is a new array key for the language.
For example:

<?php
$node->field_your_field['en'][0]['value'];
?>

 
This can be quite useful but makes it difficult to access the right data.
So here is a handy solution:

<?php
$items = field_get_items('node', $node, 'field_yourfield', $node->language);
?>

 
You can leave the $node->language argument empty. If done the current language will be called automatically:




Drupal 7 Mehrsprachigkeit

Bzgl. dem aktuellen Stand über Mehrsprachigkeit in Drupal 7 und Neuerungen ist folgende Drupalcon Session von Kopenhagen empfehlenswert: http://www.archive.org/details/IntroductionToI18NInDrupal7




Subscribe to RSS - i18n

Powered by Drupal7