claro_form_views_ui_config_item_form_alter() assumes a suffix when there is a prefix leading to: Undefined index #suffix in $form['options']['value']

Created on 30 November 2021, over 3 years ago
Updated 23 April 2024, about 1 year ago

Problem/Motivation

There are certain contrib modules which further extends the functionality of views by providing new features, for example new filters, etc. One such example is when using contrib module called select_translation. Now this module for provides a new custom filter but, when using this module with Claro theme in views UI we get an ajax error. This error comes from Claro.theme file from line 1547 which is unable to find
$form['options']['value']['#suffix']. The line of code is

line: 1546

$form['options']['operator']['#prefix'] = '<div class="views-config-group-region">' . str_replace($left_class, 'views-group-box--operator', $form['options']['operator']['#prefix']);

line: 1547

$form['options']['value']['#suffix'] = $form['options']['value']['#suffix'] . '</div>';

Due to this ajax error, the filter is cannot be edited/modified as the views_ui does not open the filter so that we could view its content.

There is also a @todo mentioned few lines above pointing to url https://drupal.org/node/3164890
todo is as follows

Many of the changes to classes within this conditional may not be needed or require refactoring in https://drupal.org/node/3164890

Since there is a todo already mentioned and the theme is constantly updating we need to provide some sort of condition which can avoid such issues.

Steps to reproduce

This can be reproduced by using
Drupal Core: 10.2.4
Admin Theme: Claro

Create a random node view of type article or basic page, add some fields, add some filter and then add filter "Select translation", you will not be able to modify the filter as it will give you an ajax error. You can check that in your console tab or networks tab in chrome by doing inspect element.

Proposed resolution

Output an empty suffix when is not present

🐛 Bug report
Status

Fixed

Version

10.2

Component
Claro 

Last updated 1 day ago

Created by

🇫🇮Finland shabbir

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024