showOperatorForm - Do not add empty prefix/suffix

Created on 7 December 2023, 12 months ago

Follow-up to 🐛 Claro - Views Filter Expose Option Form - Broken HTML Postponed: needs info

FilterPluginBase:showOperatorForm() unconditionally adds a prefix and a suffix div, even if the operator form is empty and therefor nothing will ever be rendered. In claro this leeds to unexpected behavior.

My suggestion therefor:

Alter

public function showOperatorForm(&$form, FormStateInterface $form_state) {
$this->operatorForm($form, $form_state);
$form['operator']['#prefix'] = '

';
$form['operator']['#suffix'] = '

';
}

to

public function showOperatorForm(&$form, FormStateInterface $form_state) {
$this->operatorForm($form, $form_state);
if (empty($form['operator'])) {
return;
}
$form['operator']['#prefix'] = '

';
$form['operator']['#suffix'] = '

';
}

🐛 Bug report
Status

Active

Version

10.2

Component
Views 

Last updated about 12 hours ago

Created by

🇩🇪Germany christianadamski Berlin, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024