Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / views / src / Plugin / views / filter / InOperator.php
index c2d5bef2db7ffcf2df3a1fc3397f9458779059f7..e0add0fcb1bb8871a9439bae65c2b1b106f85e7e 100644 (file)
@@ -88,7 +88,8 @@ class InOperator extends FilterPluginBase {
       '#type' => 'checkbox',
       '#title' => $this->t('Limit list to selected items'),
       '#description' => $this->t('If checked, the only items presented to the user will be the ones selected here.'),
-      '#default_value' => !empty($this->options['expose']['reduce']), // safety
+      // Safety.
+      '#default_value' => !empty($this->options['expose']['reduce']),
     ];
   }
 
@@ -228,7 +229,9 @@ class InOperator extends FilterPluginBase {
         '#default_value' => $default_value,
         // These are only valid for 'select' type, but do no harm to checkboxes.
         '#multiple' => TRUE,
-        '#size' => count($options) > 8 ? 8 : count($options),
+        // The value options can be a multidimensional array if the value form
+        // type is a select list, so make sure that they are counted correctly.
+        '#size' => min(count($options, COUNT_RECURSIVE), 8),
       ];
       $user_input = $form_state->getUserInput();
       if ($exposed && !isset($user_input[$identifier])) {
@@ -366,7 +369,7 @@ class InOperator extends FilterPluginBase {
           if ($values !== '') {
             $values .= ', ';
           }
-          if (Unicode::strlen($values) > 8) {
+          if (mb_strlen($values) > 8) {
             $values = Unicode::truncate($values, 8, FALSE, TRUE);
             break;
           }