Skip to content
Snippets Groups Projects
Commit 604629f3 authored by Viktor Holovachek's avatar Viktor Holovachek
Browse files

Issue #3284963 - Add support for field groups

parent 55d1355f
Branches
Tags 8.x-1.7
1 merge request!9Issue #3284963 - Add support for field groups
Pipeline #91276 passed
...@@ -70,11 +70,13 @@ div.description.formtips-processed, ...@@ -70,11 +70,13 @@ div.description.formtips-processed,
.formtips-processed.filter-guidelines, .formtips-processed.filter-guidelines,
div.description.formtips-processed, div.description.formtips-processed,
.form-item .description.formtips-processed, .form-item .description.formtips-processed,
.form-item__description.formtips-processed { .form-item__description.formtips-processed,
.fieldset__description.formtips-processed {
background-color: #1e2021; background-color: #1e2021;
} }
.formtips-processed.filter-guidelines .filter-guidelines-item { .formtips-processed.filter-guidelines .filter-guidelines-item,
.fieldset__description.formtips-processed {
margin: 0; margin: 0;
color: #fff; color: #fff;
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
selectors = selectors.join(', '); selectors = selectors.join(', ');
} }
var $descriptions = $('.form-item .description,.form-item__description,.form-item .filter-guidelines') var $descriptions = $('.form-item .description,.form-item__description,.form-item .filter-guidelines,.fieldset__description')
.not(selectors) .not(selectors)
.not('.formtips-processed'); .not('.formtips-processed');
...@@ -61,7 +61,8 @@ ...@@ -61,7 +61,8 @@
if (descriptionId.endsWith('-format-guidelines')) { if (descriptionId.endsWith('-format-guidelines')) {
// Grab the field id from guidelines // Grab the field id from guidelines
fieldId = descriptionId.slice(0, -18) + '-value'; fieldId = descriptionId.slice(0, -18) + '-value';
} else { }
else {
// Otherwise grabs it from the field description // Otherwise grabs it from the field description
fieldId = descriptionId.substring(0, descriptionId.lastIndexOf("-") - 1); fieldId = descriptionId.substring(0, descriptionId.lastIndexOf("-") - 1);
} }
...@@ -69,6 +70,16 @@ ...@@ -69,6 +70,16 @@
// First try to find a label associated with that field // First try to find a label associated with that field
var $label = $item.find('[for="' + fieldId + '"]:not(.visually-hidden)'); var $label = $item.find('[for="' + fieldId + '"]:not(.visually-hidden)');
// Try to get the fieldset from the Field Group module.
if (!$label.length) {
$label = $('fieldset.field-group-fieldset[id="' + fieldId + '"] .fieldset__label:not(.visually-hidden)');
}
// Try to get the fieldset of the checkboxes element.
if (!$label.length) {
$label = $('fieldset.fieldgroup[id="' + fieldId + '"] .fieldset__label:not(.visually-hidden)');
}
// Try to get the label that was added as a placeholder. // Try to get the label that was added as a placeholder.
if (!$label.length && $('#' + fieldId).attr('placeholder')) { if (!$label.length && $('#' + fieldId).attr('placeholder')) {
$label = $item.find('[for="' + fieldId + '"]'); $label = $item.find('[for="' + fieldId + '"]');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment