From 6f7fcebcf06794afb2a174abed67fea883e2eadb Mon Sep 17 00:00:00 2001 From: tadean <51835841+tadean@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:34:07 -0700 Subject: [PATCH] Fixes #2362 Publication Views exposed filters overlap (#2469) --- .../custom/az_publication/az_publication.module | 14 ++++++++++++-- .../views-exposed-form--az-publications.html.twig | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/custom/az_publication/az_publication.module b/modules/custom/az_publication/az_publication.module index ffd985d2a7..ea02909f40 100644 --- a/modules/custom/az_publication/az_publication.module +++ b/modules/custom/az_publication/az_publication.module @@ -302,9 +302,19 @@ function az_publication_preprocess_views_view(&$variables) { if (!empty($variables['id'])) { // Only run for publication search. if ($variables['id'] === 'az_publications') { - // Allow the publication year field to shrink if present. + // Reduce the width of the text input form elements from the default. + $resize_element = [ + 'name', + 'title', + ]; + foreach ($resize_element as $element) { + if (!empty($variables['exposed'][$element])) { + $variables['exposed'][$element]['#size'] = 20; + } + } + // Year field doesn't need a standard width text field. if (!empty($variables['exposed']['field_az_publication_date_value'])) { - $variables['exposed']['field_az_publication_date_value']['#wrapper_attributes']['class'][] = 'flex-shrink-1'; + $variables['exposed']['field_az_publication_date_value']['#size'] = 6; } if (!empty($variables['exposed']['field_az_publication_type_value'])) { // Add class so publication type select is styled like text inputs. diff --git a/modules/custom/az_publication/templates/views-exposed-form--az-publications.html.twig b/modules/custom/az_publication/templates/views-exposed-form--az-publications.html.twig index 79aedf0084..6519490f79 100644 --- a/modules/custom/az_publication/templates/views-exposed-form--az-publications.html.twig +++ b/modules/custom/az_publication/templates/views-exposed-form--az-publications.html.twig @@ -16,6 +16,6 @@ #} {{ q }} {% endif %} -