Issue #2920039: Views' User Name exposed group filter validation
4 unresolved threads
Merge request reports
Activity
95 95 96 96 if ($this->options['is_grouped'] && isset($this->options['group_info']['group_items'][$input])) { 97 97 $this->operator = $this->options['group_info']['group_items'][$input]['operator']; 98 $input = $this->options['group_info']['group_items'][$input]['value']; 98 $this->validated_exposed_input = $this->options['group_info']['group_items'][$input]['value']; 99 return; 99 100 } 100 101 101 102 $uids = []; 102 $values = $form_state->getValue($identifier); 103 if ($values && (!$this->options['is_grouped'] || ($this->options['is_grouped'] && ($input != 'All')))) { 104 foreach ($values as $value) { 103 if ($input && (!$this->options['is_grouped'] || ($this->options['is_grouped'] && ($input != 'All')))) { Technically, this change is not necessary. It's just to avoid duplicated
$form_state->getValue($identifier)
, because the result is already available in$input
variable.Edited by Ivan Doroshenko
124 148 return parent::adminSummary(); 125 149 } 126 150 151 /** 152 * {@inheritdoc} 153 */ 154 public function buildExposedFiltersGroupForm(&$form, FormStateInterface $form_state) { 155 // Rewrite the numeric values for textfields to entity labels for 156 // autocomplete. 157 foreach ($this->options['group_info']['group_items'] as $key => $item) { 158 if (!empty($item['value'])) { 159 $users = User::loadMultiple(($item['value'])); 160 $this->options['group_info']['group_items'][$key]['value'] = EntityAutocomplete::getEntityLabels($users); 39 44 } 40 45 41 46 protected function valueValidate($form, FormStateInterface $form_state) { 42 $uids = []; 43 if ($values = $form_state->getValue(['options', 'value'])) { 44 foreach ($values as $value) { 45 $uids[] = $value['target_id']; 47 // Autocomplete puts the values in target_id. Move the values to the 48 // expected depth. 49 // @todo Consider creating a trait/whatever to avoid duplicate code here
Please register or sign in to reply