I upgraded to the 15 sept Dev version and the following errors come up.

Notice: Undefined variable: items in conditional_fields_entity_view_alter() (line 760 of C:\wamp\www\drupal\sites\all\modules\conditional_fields\conditional_fields.module)

The error below comes when I edit the dependency

Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument in in_array() (line 461 of C:\wamp\www\drupal\sites\all\modules\conditional_fields\includes\conditional_fields.admin.inc). => 
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chalee’s picture

Seems the errors have all disappeared.

Second error went away when I did a fresh installation of the module
First error disappeared when I checked the following 'View settings' option:

Hide the dependent if the dependee is not viewable by the user and the dependency is not triggered

tedfordgif’s picture

Status: Active » Needs work

This is still an issue for some configurations. Here is a patch showing the condition/else that was missed. Another possibility would be to continue from this else clause--I haven't looked at the issue in depth.

--- conditional_fields/conditional_fields.module
+++ conditional_fields/conditional_fields.module
@@ -753,6 +753,9 @@
           $build[$dependent]['#access'] = FALSE;
           continue;
         }
+        else {
+          $items = array();
+        }
       }
       else {
         $items = $build[$dependee]['#items'];
g10’s picture

#2 solves the error messages,

but there is an option missing on the node view settings, for example:
if you use a field (eg. drop down) on the edit form to toggle between 2 fields, on the node view you hide the toggle field (drop down, as it's only purpose is to toggle on the edit form), then the 2 fields are not triggered anymore, so both show up (if they contain a value)… it would be nice if the dependency is still working all thought the dependee field is hidden

Deciphered’s picture

FileSize
453 bytes

Turned #2 into a real patch so it can be used in a Drush make file.

nicksanta’s picture

Patch from #4 stops error messages, but @g10's issue is also present.

Deciphered’s picture

Status: Needs work » Needs review
FileSize
751 bytes

New patch, patch at #4, based on #2, prevented the error but caused my items not to render.

Haven't looked into this fix enough to really say if it's a better solution, but it works in my situation and therefore I need the patch to be available for my personal use.

When I have some more time I'll try to look into this issue further, but at the moment I'm trying to fix the issue and make a site work correctly.

zorax’s picture

it works for me!!
regards,

Shadlington’s picture

#6 works for me too

juliusvaart’s picture

Combination of #4 and #6 work for me.

emptyvoid’s picture

Please delete post, suggestion and code sample is just wrong, horribly, horribly wrong. (facepalm)

Deciphered’s picture

emptyvoid,

Maybe some more context to your comment? Which post. suggestion and code sample are you referring to, and would you mind giving some feedback on why? Otherwise your comment just comes of as unpleasant and unhelpful.

There is a valid issue here, people need a solution, people are trying to solve the issue, how about you try helping too?

Cheers,
Deciphered.

juliusvaart’s picture

I think emptyvoid was referring to his own post (which he changed into what it is now, but without the old post the context is gone).

Deciphered’s picture

Righteo.... hard to get that from that comment, it doesn't exactly stand on it's own.

peterpoe’s picture

Status: Needs review » Needs work

#6 The patch avoids the error but doesn't solve the problem: the #items property *should* always be there if the field is present. Could you provide more information about your setup so we can properly handle this situation?

Anonymous’s picture

Selecting the third hide option on the view tab triggers a separate bug which is that not all fields will render when it's selected. Changing that option to be unchecked is what triggered the error described in this thread, hence why I'm here. So it's not simply an issue of "check this box and it's fixed". There are multiple bugs going on that leave some users with no viable working option.

guykit’s picture

I have similar problem: it all works fine when the controlling field is visible but when I set it to hidden I get the error message above (except mine says different line#) #6 patch gets rid of the error message but dependant field stops showing even when condition is met.

I am using a radio button with allowed values as controlling field with text field as dependant.

I am hiding field because I want to choose when the dependant field info shows, not the users.

milos.kroulik’s picture

I was able to use patch in #6 manually, even though the line of error was 913 in my case. Seems to be working so far, so I would like to see this commited.

EDIT: There is problem with this, as the dependent is displayed even if "Hide the dependent if the dependency is not triggered" view context option is checked. I think there might be some interference with Display Suite module, which I use.

peterpoe’s picture

Status: Needs work » Fixed

Committed a fix to this. We were not evaluating correctly field dependency in some combination of "View context" settings.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Adding the other error message