0

I have a multilingual website using Drupal 7. I installed the i18n modules (entity translation, etc). In templates, I use variables like $vars['und'].

I think Drupal ran updates. Now the template system uses $var without the language as key. I think I activated block translation. Templates still work for anonymous users, but they don't work for the administrator user.

Do you know what happened?

1 Answer 1

1

Once you are logged in, another language is requested and the 'und' key no longer works: https://www.deeson.co.uk/labs/programatically-access-field-data-using-entitymetadatawrapper-drupal Try replacing your use of $vars['und'][0]['value'] with Entity metadata wrappers. More examples here: https://www.drupal.org/documentation/entity-metadata-wrappers

1
  • You are right. I think that field_get_items will also work in this situation. Oct 21, 2014 at 4:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.