Having installed both 5.x.2.x-dev and 5.x-1.2 versions of this module I am getting:

warning: Invalid argument supplied for foreach() in views_checkboxes.module on line 83.

Line 83 is:

foreach ($form['filter'.$count]['#options'][$option_id]->option as $num => $val) {

Any ideas?

CommentFileSizeAuthor
#7 views_checkboxes.module.txt3.48 KB2c
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

2c’s picture

I think I might have fixed it.

Change

line 83:

 foreach ($form['filter'.$count]['#options'][$option_id]->option as $num => $val) {
            $newoptions[$num] = $val;
          }

to this:

$newoptions[$option_id] = $option;

I imagine this 'fix' will cause problems later?

Update:

Sorry, I didn't realize there was another bug report about this issue. I could have sworn it wasn't there ten minutes ago :(

nschelly’s picture

Assigned: Unassigned » nschelly

That fix isn't really what you want to do. Did the last patch submitted here work for you? http://drupal.org/node/192117
-N

2c’s picture

Unfortunately it didn't. It didn't show any error messages, but there was no data shown on my webpage...blank output by your module and everything else normal.

Maybe it's due to the way different versions of Views/CCK deal with checkboxes? Sorry I can't help.

nschelly’s picture

I'm not sure I'm clear on the problem you're having then. Since you said it had already been reported, I was assuming it was the same as the other issue.

Can you post up a screenshot of the problem and also the exported of the view configuration so I can recreate it?
-N

2c’s picture

I'm not having a problem any more and that's because of the 'fix' I described earlier in my thread. My problem was the same as that *originally* described here: http://drupal.org/node/192117

Out of interest (not because I currently seem to need it) I applied this patch (http://drupal.org/files/issues/views_checkboxes-patch.txt) but that didn't work. It didn't give any error messages, but no checkboxes were exposed at all.

I've sent you a PM(email?) with an export of my view.

2c’s picture

Ah!! My 'fix' doesn't work with an array of objects...TAXONOMY TERMS! Maybe that's where the problem lies..taxonomy terms are an array of objects whereas CCK select items aren't (just arrays)?? That would explain the foreach error with your module when I try to display a CCK select item and why my 'fix' is working on CCK items and not on taxonomy terms.

A check to see if $form['filter'.$count]['#options'] is an array of objects before looping through it might help.

2c’s picture

FileSize
3.48 KB

My idea referred to directly above works for me and all the errors have disappeared. I've attached my module in full, so it's not a patch. It's based on 5.x-1.2.

I don't know how to apply patches yet. :(

Note: you will have to remove the .txt file extension of the included file if this is to work on your Drupal site.

2c’s picture

Update: The 'forced single' option doesn't work. Maybe this is related to the *ALL* filters problem you were referring to in the other issue.

This is the error message I get if I use radiobuttons('force single'):

warning: htmlspecialchars() expects parameter 1 to be string, array given in /hshome/hsphere/local/home/conorole/scoopkorea.com/includes/bootstrap.inc on line 589

nschelly’s picture

I just posted a new release, 1.3 that I suspect will repair the issue you're reporting. As you suspected, it originated from having select box filters that were not based on taxonomy terms. I was able to get a forced single one to work though, so I'm not entirely sure what problem you were having. I'll keep trying to recreate it. Let me know if you have good luck with the new release, when it posts up.
-N

pinow’s picture

edit: look at this: http://drupal.org/node/220782

nschelly’s picture

Status: Active » Closed (fixed)

I think this is resolved and pinow's request is being handled in the other issue.
-N