fieldset.js 673 B

123456789101112131415161718192021222324
  1. (function ($) {
  2. 'use strict';
  3. Drupal.FieldGroup = Drupal.FieldGroup || {};
  4. Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {};
  5. /**
  6. * This script adds the required and error classes to the fieldset wrapper.
  7. */
  8. Drupal.behaviors.fieldGroupDFieldset = {
  9. attach: function (context) {
  10. $(context).find('.field-group-fieldset').once('field-group-fieldset').each(function () {
  11. var $this = $(this);
  12. if ($this.is('.required-fields') && ($this.find('[required]').length > 0 || $this.find('.form-required').length > 0)) {
  13. $('legend', $this).first().addClass('form-required');
  14. }
  15. });
  16. }
  17. };
  18. })(jQuery);