Problem/Motivation

I'm not sure whether this is equivalent to any of the several other language-related issues, so forgive me if this is a dupe.

I have a view on a search index, and I want to use the Rendered Entity row style plugin for my nodes.

In a normal node.tpl.php file, the field variables are all in the correct current language. That is, if you have the 'body' and 'field_location' fields, you will have something like $body[0]['value'] and $field_location[0]['value'] variables.

However, in a search index view, for all rendered nodes it shows — whether you use the "Rendered Entity" plugin or the "Rendered node" field — any fields not being indexed by the search will have their language code in the array.

So for instance, if I have a node as described above, and 'body' is being indexed but 'field_location' is not, the node.tpl.php variables will instead be like $body[0]['value'] and $field_location['und'][0]['value'].

Obviously, this deviation from normal Drupal template behavior throws a wrench in theme development. I no longer have time to try to fix this right now, so I'm posting this, and may come back to it later.

Proposed resolution

Construct the views data to have the correct field variables, somehow. I tried to go down the rabbit hole and fix this myself, but I'm not already familiar with the way views objects interact with the theme system, and I ran out of time to devote to this before finding an answer.

Remaining tasks

...

User interface changes

None, probably.

API changes

There may be people depending on the broken behavior, but since it differs between fields on the same node depending on Search API settings, it probably ought to be fixed anyway.

Data model changes

None

Comments

Lanny Heidbreder’s picture

Issue summary: View changes
drunken monkey’s picture

Project: Search API » Entity API

Huh. That sounds really weird, yes. It'd also be weird that no-one else has ever noticed this.

In any case, the "Rendered entity" row plugin is provided by the Entity API, so probably that's where this would have to be fixed?
Or, it seems somehow a broken entity arrives there? Not really sure where this could go wrong.