I wrote my own handler based on views_handler_filter_in_operator handler, where I gave $value_form_type the 'radios' value.
After opening the filter, I got the following error message:

warning: htmlspecialchars() expects parameter 1 to be string, array given in /Users/york/www/lada/includes/bootstrap.inc on line 857.
warning: htmlspecialchars() expects parameter 1 to be string, array given in /Users/york/www/lada/includes/bootstrap.inc on line 857.

I started investigating the problem, and I found that, the variable type of the #default_value of the 'radios' type form is array instead of string.
Because of that, the admin_summary() function also returned a wrong value.
I managed to rewrite these in my own hander, so I could continue working, but while testing expose filter, I came across a following error, when generating a 'select' form element:

An illegal choice has been detected. Please contact the site administrator.

It took me a while to recognize that, this is because the default value of 'radios' field is string instead of array.

CommentFileSizeAuthor
#1 views-939468-1.patch1.15 KBmr.york

Comments

mr.york’s picture

Status: Active » Needs work
StatusFileSize
new1.15 KB

I modified the handling of 'radios' value in 'admin_summary' and 'value_form' functions.
I couldn't find the way to avoid the error, when using expose filter though.
To avoid the problem above, I modified my own handler the following way:

  function exposed_form(&$form,&$form_state) {
    parent::exposed_form($form, $form_state);

    $value = $this->options['expose']['identifier'];

    $this->value = (array)$this->value;
    if ( empty($form_state['input'][$value]) ) {
      $form_state['input'][$value] = 'All';
    }
    $form_state['input'][$value] = (array)$form_state['input'][$value];
  }
dawehner’s picture

Just as a reminder. You might fix the codestyle issues before setting it to "needs review".

mr.york’s picture

Sorry, but I can't say, I understand what do you want me to do here. I can't see anything in the code, that is against the coding standards. I can't do anything more to solve the problem now, because I don't know where to debug the other error I found. That's why I set the issue to 'needs work'. I need some info regarding where should I correct the code, or someone, who can do this instead of me.
Thank you in advance.

dawehner’s picture

Just a short example

+    if ( (!is_array($this->value)) && (!empty($this->value)) ) {
+      return check_plain($info[$this->operator]['short_single']) .' '. $this->value;
+    }

should be

+    if ((!is_array($this->value)) && (!empty($this->value))) {
+      return check_plain($info[$this->operator]['short_single']) . ' ' . $this->value;
+    }
dawehner’s picture

And even better


+    if (!is_array($this->value) && !empty($this->value)) {
+      return check_plain($info[$this->operator]['short_single']) . ' ' . $this->value;
+    }
mr.york’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)