Consequently the relevant alters cant do much useful. Pity.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | field_get_display_830020.patch | 3.01 KB | yched |
| #4 | field_display_alter_entities.patch | 2.86 KB | chx |
| #2 | field_display_alter_entities.patch | 2.5 KB | chx |
Consequently the relevant alters cant do much useful. Pity.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | field_get_display_830020.patch | 3.01 KB | yched |
| #4 | field_display_alter_entities.patch | 2.86 KB | chx |
| #2 | field_display_alter_entities.patch | 2.5 KB | chx |
Comments
Comment #1
catchsubscribe.
Comment #2
chx commentedBut fixing this is not hard.
Comment #3
yched commentedCould you provide a use case ?
(why not I guess, but why ?)
- this needs to be altered in hook_field_display_ENTITY_TYPE_alter() as well, and in the existing node_field_display_node_alter() implementation.
Comment #4
chx commentedthe implementation in node hardly needs a change. we just add more stuff to context but we are fine w not using it.
Use case, sticky posts show an image in teaser, otherwise dont. The fastest way to not show an image is to set the field display to hidden.
Most importantly, why not? :)
Comment #5
yched commentedYes, but
field_default_prepare_view() runs in 'multiple entities' mode (that's because hook_field_prepare_view() and hook_field_formatter_prepare_view() typically load additional stuff from the db).
Here field_get_display() is called in the context of several entities and returns one $display. So your alter hook can't separate sticky nodes from non-sticky ones.That's why I'm wondering about use cases at all.
Comment #6
yched commentedHm, I was on crack when writing the above.
field_default_prepare_view() runs in 'multiple entities' mode, but calls field_get_display() entity by entity ($id by $id).
So it should be ok, but the additional $context entry is 'entity', not 'entities'
See attached patch (my first patch using git :-p)
Comment #7
chx commentedAh ha! Good one, thanks.
Comment #8
sun#6: field_get_display_830020.patch queued for re-testing.
Comment #9
tom_o_t commented#6: field_get_display_830020.patch queued for re-testing.
Comment #10
dries commentedThis makes sense to me. Committed to CVS HEAD.