1(function ($, once) { 2 /** 3 * Opens Tab field group with invalid input elements. 4 */ 5 const fieldGroupTabsOpen = function ($fieldGroup) { 6 if ($fieldGroup.data('verticalTab')) { 7 $fieldGroup.data('verticalTab').tabShow(); 8 } else if ($fieldGroup.data('horizontalTab')) { 9 $fieldGroup.data('horizontalTab').tabShow(); 10 } else { 11 $fieldGroup.attr('open', ''); 12 } 13 }; 14 15 /** 16 * Behaviors for tab validation. 17 */ 18 Drupal.behaviors.fieldGroupTabsValidation = { 19 attach(context) { 20 const $inputs = $('.field-group-tabs-wrapper :input', context); 21 22 /** 23 * Invalid event handler for input elements in Tabs field group. 24 */ 25 const onTabsInvalid = function (e) { 26 $inputs.off('invalid.field_group', onTabsInvalid); 27 $(e.target) 28 .parents( 29 'details:not(:visible), details.horizontal-tab-hidden, details.vertical-tab-hidden', 30 ) 31 .each(function () { 32 fieldGroupTabsOpen($(this)); 33 }); 34 requestAnimationFrame(function () { 35 $inputs.on('invalid.field_group', onTabsInvalid); 36 }); 37 }; 38 39 $(once('field-group-tabs-validation', $inputs)).on( 40 'invalid.field_group', 41 onTabsInvalid, 42 ); 43 }, 44 }; 45})(jQuery, once);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.