Hi everyone, we love the conditional field module and want to share a bugfix.
In function \conditional_fields_form_after_build() fields which have a different option than "value" are not beeing evaluated.
See Line 508 in sites/all/modules/conditional_fields/conditional_fields.module:
// Conditions different than "value" are always evaluated against TRUE.
But if you mix none value and value dependencies for one field it gets evaluated in conditional_fields_dependent_validate(). (See Attachment Auswahl_814.png)
When the dependent is evaluated in conditional_fields_dependent_validate() the function checks if its beeing triggered by calling conditional_fields_evaluate_dependencies(). Sadly conditional_fields_dependent_validate() also evalutes the non value dependencys which of course fails.
Ive modified the following code that dependencies with mixed value and none value are considered correctly as triggered.
// Conditions different than "value" are always evaluated against TRUE.
if($dependency['options']['condition'] !== "value"){
$evaluated_dependees[$dependent['#field_name']][$dependency['options']['grouping']][] = TRUE;
}else {
$evaluated_dependees[$dependent['#field_name']][$dependency['options']['grouping']][] = conditional_fields_evaluate_dependency('edit', $values, $dependency['options']);
}
Comment | File | Size | Author |
---|---|---|---|
#3 | drupal.conditional_fields.conditional_fields_evaluate_dependencies_bugfix_2467361.patch | 1.14 KB | iTiZZiMO |
Auswahl_814.png | 25.19 KB | iTiZZiMO |
Comments
Comment #1
iTiZZiMO CreditAttribution: iTiZZiMO commentedComment #2
iTiZZiMO CreditAttribution: iTiZZiMO commentedComment #3
iTiZZiMO CreditAttribution: iTiZZiMO commentedComment #4
iTiZZiMO CreditAttribution: iTiZZiMO commentedComment #7
peterpoe CreditAttribution: peterpoe as a volunteer commentedCommitted, thanks!