field_view_field() calls the field_attach_view alter hook with view_mode = '_custom'. Hence the notice on line 64 when trying to get the display.
Guessing that it's possible another call could be made with a different view_mode also not set in the display it's probably best to just do a isset() before grabbing the display.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | undefined_index-1543222-3.patch | 844 bytes | olofbokedal |
| #2 | 1543222.field_word_boundary.view_mode_notice.patch | 768 bytes | ekes |
| #1 | 1543222.field_word_boundary.view_mode_notice.patch | 785 bytes | ekes |
Comments
Comment #1
ekes commentedLike...
Comment #2
ekes commentedEmbarrassing sorry rushing around here a dsm() left in that!
Comment #3
olofbokedal commentedAlthough
field_view_field()seems to callhook_field_attach_view_alter()with the _custom view mode, it seems that we're not getting the _custom view mode in$context. I don't know when this is altered, but I can't manage to reproduce this.However, I'm getting the undefined index notice when I'm viewing the full node, without using a custom display configuration for Full content. AFAIK, that's the only view mode that will get called without having a custom configuration. This means that we should fallback to the default settings, when the current view mode doesn't have a configuration.
Please try this patch, and report the results :)
Comment #4
olofbokedal commentedI assume that that the silence means that it's working.
The patch has been committed http://drupalcode.org/project/field_word_boundary.git/commit/7c6cff6.
Comment #6
gianfrasoft commentedAfter ugrade I have this other problem:
Notice: Undefined index: word_boundary in field_word_boundary_field_attach_view_alter() (line 69 of .../field_word_boundary/field_word_boundary.module).
Comment #7
olofbokedal commentedStandardized the settings, to make sure that they'll never be undefined.
http://drupalcode.org/project/field_word_boundary.git/commit/50082c7.