Skip to content
Snippets Groups Projects
Commit f26be288 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch 'feature/ISTWCMS-6944-ebremner-fix-search-block-labels' into '1.1.x'

ISTWCMS-6944: add label to block title if flag is set

See merge request !131
parents 8115e2ce cea787b3
No related branches found
No related tags found
1 merge request!131ISTWCMS-6944: add label to block title if flag is set
......@@ -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 %}
......
......@@ -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'];
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment