Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #1630820: entity_field_value is completely broken
As dgdrupler comented in #77 it is not working for unlimited multiple value fields.
In my case I have a "List (integer)" type field with unlimited values attached to a Account entity. I've attempted to use a panels visibility rule to filter by this list and it doesn't appear to be working.
It seems that the configured values aren't saved. The visibility rule summary says: {Field Name} is set to """
.
Comment | File | Size | Author |
---|---|---|---|
#4 | ctools-access_settings_saving-2501751-4.patch | 960 bytes | maximpodorov |
Comments
Comment #1
osopolarIt is only the case for unlimited values. If there is a Multiple value field with i.e. max 10 values and all or some values are provided it works well. How/where are limited and unlimited multiple value fields treated differently?
Comment #2
maximpodorov CreditAttribution: maximpodorov commentedHmm, very strange. I tested this case, everything was OK. I can see and fix this problem.
Comment #3
osopolarI'd like to help fixing this, but can't see where the problem is. The result of
ctools_entity_field_value_ctools_access_settings_submit()
is in both cases (limited and unlimited values) the same. My idea was, that it is related to field-cardinality, because for unlimited value fields it is-1
, for limited values it is> 1
. I searched in ctools for cardinality, but could not find any use likecardinality > 1
.@maximpodorov: If you point me in the right direction I could provide a patch for this bug.
Comment #4
maximpodorov CreditAttribution: maximpodorov commentedSomething strange happens with the form state:
After that, $form_state['access'] != $access.
So I suggest to extract $access from $form_state['access'] before using it. The patch adds such extraction.
The same problem exists in Panels module which requires a separate patch.
Comment #5
maximpodorov CreditAttribution: maximpodorov commentedThe issue and the patch for Panels: #2504465: Visibility rules aren't saved for unlimited multiple value fields.
Comment #6
osopolarThanks maximpodorov, this works for me.
Comment #7
crmn CreditAttribution: crmn commentedpatch #4 works for me
Comment #8
DamienMcKennaThis seems pretty safe.
Comment #9
DamienMcKennaThis didn't get added to 7.x-1.10.
Comment #10
MichelleI am trying to test this but unable to reproduce it. I added a list field of unlimited cardinality to my article node type. Then I went into the node_view and added a selection rule based on the value of it. It showed up as expected. I looked at the function the patch is addressing and it doesn't look to be using $form_state. I'm wondering if this code has changed since the patch was made? If someone could provide exact steps to reproduce, I'd be happy to try again.
Comment #11
rivimeyCan someone please confirm this is still a bug, and if so provide details of how to reproduce it.
Comment #12
ZhuRenTongKu CreditAttribution: ZhuRenTongKu commentedI am able to reproduce this with the following.
Ctools version = "7.x-1.12"
Now edit this visibility rule and find the value empty. Also, the summary text will be displayed as 'bar is set to ""'
Hope this helps.
Comment #13
osopolarSee info in #12.
Comment #14
philsward CreditAttribution: philsward commentedSince this issue has garnered more attention than the similar panels version #2504465: Visibility rules aren't saved for unlimited multiple value fields, I will leave the status as-is, however I would like to make a notion that we move for the inclusion of the patch from #4, if anything to fix the issue with panels where a 'null' or empty value field isn't saving the "NOT" declaration.
By applying both this patch and the patch mentioned above for panels, I am able to save it to NOT show the null / empty value.
This patch does fix at least one problem associated with it. I suggest that instead of leaving this problem open for longer than it needs to be in order to "fix everything", we get this patch committed and address the multivalue issue in a new thread if the problem still exists.
Unless someone has an objection, let's move this to RTBC so it can gain some attention for being committed so more focus can be placed on issue #1188466: Add a simple selection rule for checking if a field is empty which will allow the visibility to actually work against an empty / null value. Patch #42 from that thread appears to be working just fine.
Comment #15
philsward CreditAttribution: philsward commentedMarking this as RTBC because the supplied patch fixes most, if not all of the problems described. Since there have been no other patches to enhance the original, and I have personally used this on multiple sites (as recently as July 2017) with the intended outcome the patch fixes (along with the others mentioned), I believe it's "finally" time to get this committed.
Comment #16
philsward CreditAttribution: philsward commentedTagging the next stable release for being committed.
Comment #17
japerryI agree we can continue this in another issue. This small patch does somewhat fix the issue at hand. Panels isn't committed yet, but will be forthcoming. Fixed.
Comment #19
philsward CreditAttribution: philsward commentedSweet!!! Million Thx @japerry!