[development] Views 3 custom handler (was Custom Handlers for Views 2)

Larry Garfield larry at garfieldtech.com
Sun Nov 21 23:45:19 UTC 2010


'und' indicates that the field's value does not change with the language of 
the site.  If the field had multiple translations, then und would be replaced 
with the appropriate language code, such as 'en-us' or 'fr'.  For that reason 
you don't want to hard-code 'und', and instead use the appropriate language 
value there instead.

How you get the appropriate language value in that context... I have no idea.  
I actually find the data structure for Fields in D7 to be completely 
incomprehensible and virtually unusable so the fact that you managed to make 
it that far is a miracle. :-)

--Larry Garfield

On Sunday, November 21, 2010 5:20:23 pm jeff at ayendesigns.com wrote:
> I will write it up. That said, I got it working this afternoon! I'm a
> little unsure about one part though, where I pluck the field's value
> from the value array. It seems that there should be a more elegant way
> of walking to the correct index than this:
> 
> $values->_field_cache[$this->field_alias]['object']->{$this->definition['fi
> eld_name']}['und'][0]['safe_value'];
> 
> and in particular, the ['und'][0]['safe_value'] part of it. In my case,
> it is predictable that there will only be one instance of the field in
> the row, so the [0] is ok, otherwise I'd loop. I guess it's the ['und']
> that is bothering me, especially not knowing what 'und' indicates.
> 
> On 11/21/2010 01:34 PM, Earl Miles wrote:
> > This is an interesting side effect of field API, and you're right. It
> > will be more difficult to make what used to be simple changes. You are
> > blazing new territory with this, and what you are doing may be an
> > uncommon but important need for advanced Views users. Please be sure to
> > write up what you have discovered so that we can document this and
> > hopefully the next person to do it doesn't have to spend weeks figuring
> > out the levels of abstraction to make deep modifications to field api
> > fields.


More information about the development mailing list