diff --git a/templates/blocks/block.html.twig b/templates/blocks/block.html.twig index 7793c74802c1ef864fb8dd705f85c4c9c6ac859d..0a32bee63c4bca42ca5d97e8137c5e06acfc2a15 100644 --- a/templates/blocks/block.html.twig +++ b/templates/blocks/block.html.twig @@ -44,11 +44,17 @@ {% endif %} {{ title_prefix }} {% if label %} + {% if add_label_flag %} + <label for="{{ label_for }}"> + {% endif %} {% if heading_level %} <{{ heading_level }}{{ title_attributes }} class="block-title">{{ label }}</{{ heading_level }}> {% else %} <h2{{ title_attributes }}>{{ label }}</h2> {% endif %} + {% if add_label_flag %} + </label> + {% endif %} {% endif %} {{ title_suffix }} {% block content %} diff --git a/uw_fdsu_theme_resp.theme b/uw_fdsu_theme_resp.theme index 671b709c9301bb606465d9775fbd4e51dac6784d..3d3505f966e8fa2852bb943e4abac465f5ac19b3 100644 --- a/uw_fdsu_theme_resp.theme +++ b/uw_fdsu_theme_resp.theme @@ -736,37 +736,45 @@ function uw_fdsu_theme_resp_preprocess_details(&$variables) { } else { - // If there is an element, process it. - if (isset($variables['element'])) { + // Search input needs a special form id, so setting that, if not + // We continue the old fix. + if (isset($variables['element']['search'])) { + $variables['form_field_id'] = $variables['element']['search']['#attributes']['id']; + } + else { - // Step through each of the indexes and ensure that we - // have an actual element, which means it will be an array. - foreach ($variables['element'] as $index => $value) { + // If there is an element, process it. + if (isset($variables['element'])) { - // If this is an array, then we have an element to look at. - if (is_array($value)) { + // Step through each of the indexes and ensure that we + // have an actual element, which means it will be an array. + foreach ($variables['element'] as $index => $value) { - // One more check to ensure that we have an element. - if (isset($variables['element'][$index]['#type'])) { + // If this is an array, then we have an element to look at. + if (is_array($value)) { - // Get the id based on where the id is stored, either it - // is by itself or within the attributes. - if (isset($variables['element'][$index]['#id'])) { - $variables['form_field_id'] = $variables['element'][$index]['#id']; - } - elseif (isset($variables['element'][$index]['#attributes']['id'])) { - $variables['form_field_id'] = $variables['element'][$index]['#attributes']['id']; - } + // One more check to ensure that we have an element. + if (isset($variables['element'][$index]['#type'])) { + + // Get the id based on where the id is stored, either it + // is by itself or within the attributes. + if (isset($variables['element'][$index]['#id'])) { + $variables['form_field_id'] = $variables['element'][$index]['#id']; + } + elseif (isset($variables['element'][$index]['#attributes']['id'])) { + $variables['form_field_id'] = $variables['element'][$index]['#attributes']['id']; + } - // Break out of the loop to save computational time. - break; + // Break out of the loop to save computational time. + break; + } } } } - } - // If there is a data drupal selector use it for form field id. - elseif (isset($variables['element'][0]['#attributes']['data-drupal-selector'])) { - $variables['form_field_id'] = $variables['element'][0]['#attributes']['data-drupal-selector']; + // If there is a data drupal selector use it for form field id. + elseif (isset($variables['element'][0]['#attributes']['data-drupal-selector'])) { + $variables['form_field_id'] = $variables['element'][0]['#attributes']['data-drupal-selector']; + } } } }