Skip to content
Snippets Groups Projects
Commit 4f6d5540 authored by Eric Bremner's avatar Eric Bremner Committed by Lily Yan
Browse files

ISTWCMS-6945: fix logic for getting id in details/summary

parent 0e85fc9e
No related branches found
No related tags found
1 merge request!134ISTWCMS-6945 Fix details label
......@@ -736,8 +736,36 @@ function uw_fdsu_theme_resp_preprocess_details(&$variables) {
}
else {
// If there is an element, process it.
if (isset($variables['element'])) {
// 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 this is an array, then we have an element to look at.
if (is_array($value)) {
// 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;
}
}
}
}
// If there is a data drupal selector use it for form field id.
if (isset($variables['element'][0]['#attributes']['data-drupal-selector'])) {
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