I have a select list created by views exposed filters.
When I debug the templates used. I have the exposed filter template, then the select list is in a seperate template.
I tried just putting my html in the exposed filter around {{form}}. This put the html around the whole form, including labels, other containers etc, which didn’t work for my situation.
So I am trying to target the select list directly using this answer here
function HOOK_theme_suggestions_select_alter(array &$suggestions, array $variables) { $routeObject = Drupal::routeMatch()->getRouteObject(); $view_id = $routeObject->getDefault('view_id'); $display_id = $routeObject->getDefault('display_id'); if (!empty($view_id)) { $suggestions[] = 'selectlist__' . $view_id; if (!empty($display_id)) { $suggestions[] = 'selectlist__' . $view_id . '_' . $display_id; } } }
On first load of view it works. When I update the view using ajax the twig template is no longer loaded.
I check the template suggestions and it suggests the same twig template for before using ajax and after. I am at a loss on how I can edit the select list for a specific view whilst maintaining ajax use.