Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
- I've List(text) field set-up as Check boxes with two allowed values: "PM", "BP". This is in field collection embedded in the form.
- I've dependency: My field is required when Another field has value "PM". In here, I've 'Insert value from widget' from the checkbox where I'm selecting only one option.
Now it seems conditional_fields_evaluate_dependency() doesn't comparing these values correctly in the following line:
return array_values($dependency_values) == array_values($values);
This is value of $dependency_values:
array (size=2)
'BP' => string 'BP' (length=2)
'PM' => null
comparing with $values:
array (size=2)
0 =>
array (size=1)
'value' => string 'PM' (length=2)
1 =>
array (size=1)
'value' => string 'BP' (length=2)
The format of the arrays seems to be completely different, so it'll always return FALSE.
Here are my $options:
array (size=16)
'state' => string 'required' (length=8)
'condition' => string 'value' (length=5)
'grouping' => string 'AND' (length=3)
'effect' => boolean false
'effect_options' =>
array (size=0)
empty
'element_view' =>
array (size=5)
1 => string '1' (length=1)
2 => string '2' (length=1)
5 => int 0
3 => int 0
4 => int 0
'element_view_per_role' => int 0
'element_view_roles' =>
array (size=3)
1 =>
array (size=5)
1 => string '1' (length=1)
2 => string '2' (length=1)
5 => int 0
3 => int 0
4 => int 0
2 =>
array (size=5)
1 => string '1' (length=1)
2 => string '2' (length=1)
5 => int 0
3 => int 0
4 => int 0
3 =>
array (size=5)
1 => string '1' (length=1)
2 => string '2' (length=1)
5 => int 0
3 => int 0
4 => int 0
'element_edit' =>
array (size=2)
1 => string '1' (length=1)
3 => int 0
'element_edit_per_role' => int 0
'element_edit_roles' =>
array (size=3)
1 =>
array (size=2)
1 => string '1' (length=1)
3 => int 0
2 =>
array (size=2)
1 => string '1' (length=1)
3 => int 0
3 =>
array (size=2)
1 => string '1' (length=1)
3 => int 0
'selector' => string '' (length=0)
'values_set' => string '1' (length=1)
'value_form' =>
array (size=2)
'BP' => string 'BP' (length=2)
'PM' => null
'value' =>
array (size=1)
0 =>
array (size=1)
'value' => string 'BP' (length=2)
'values' =>
array (size=0)
empty
This could be related to how the field collection is appearing in the entity form.
Comment | File | Size | Author |
---|---|---|---|
#4 | conditional_fields.module-2613522.patch | 1.14 KB | kenorb |
Comments
Comment #2
kenorb CreditAttribution: kenorb commentedComment #3
kenorb CreditAttribution: kenorb commentedWrong patch, ignore it.
Comment #4
kenorb CreditAttribution: kenorb commentedComment #6
kenorb CreditAttribution: kenorb commentedComment #7
rafenden CreditAttribution: rafenden as a volunteer and at EndCode Ltd commentedPatch in #3 will break the standard functionality of conditional fields.