Closed (duplicate)
Project:
Display Suite
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Aug 2011 at 16:37 UTC
Updated:
21 Sep 2011 at 10:27 UTC
Use case: you have a video and image field. If there's a video uploaded, do not show the image field.
Whether this might be a new sort field at admin/structure/ds/fields or someting in the UI is not decided yet.
Comments
Comment #1
muka commentedMaybe #1221892: Context module integration could help?
Comment #2
swentel commentedHrm, that's probably a good idea (haven't been able to look further on that issue, been swamped with other work right now), I'll think about it (or in case you have patches, feel free. This could all go into the ds_context module which I'll try to review soon!
Comment #3
swentel commentedThis is committed. It's a a field which acts as a 'group' where you nest children underneath. The logic is simple (and covers 95% of the use cases we have all the time): the first item with is rendered, the rest is ignored. We might extend this later on with other simple use cases, but for now this is good enough.
Comment #4
swentel commentedSetting back to needs work, it actually doesn't work with fieldgroup enabled - needs some rework (and it will be pluggable as well)
Comment #5
Shadlington commentedA common use case will be something along the lines of a controlling checkbox that hides/reveals a set of child fields.
Is that within the scope or would it be better to use a dedicated module like conditional fields?
Comment #6
swentel commentedHmm, maybe I do need to check out that module to see if I'm not doing any double work. So this might become a won't fix in the end.
Comment #7
Shadlington commentedI've only ever used it previously in a D6 site (without DS) and have no idea how well it plays with DS.
If it works with DS then that'd be great. Ensuring it does could probably be all that is required.
I'm not sure if it does that kind of switch case behaviour that your described in #3 though.
Comment #8
swentel commentedI've been trying the dev version but I can't get it to behave like I want on display level - even with no layout configured. Another problem is that DS fields are not recognized either and there is no hook. Still thinking about a simple implementation for DS (which could be hookable/pluggable)
Comment #9
yareckon commentedsub
Comment #10
Shadlington commentedFYI, a recent commit to conditional fields added: "Enhance effects system and add two new States: Filled with value / Emptied."
Which sounds like the type of condition you're after.
Comment #11
swentel commentedI've tried it out, but it doesn't work at all for me. We have another use case, coming from #1250144: Show block on specific pages settings not working, so I'll probably go ahead with an implementation of both in DS which can be pluggable as well.
Comment #12
swentel commentedMarking this duplicate and moving all this to #1237626: Themes/modules cannot alter entity render arrays before ds layouts are rendered
Comment #13
muschpusch commentedI know the issue is closed as an duplicate but a temporary solution for solving this is writing a custom field formatter (which is a solution for 99% of my problems, thanks for the tip swentel).
This is a crapy code feel free to make it better ;) The magic happens in kg_formatter_field_formatter_view()