
| Current Path : /var/www/html/strat/web/modules/contrib/webform/js/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/web/modules/contrib/webform/js/webform.element.roles.js |
/**
* @file
* JavaScript behaviors for roles element integration.
*/
(function ($, Drupal, once) {
'use strict';
/**
* Enhance roles element.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.webformRoles = {
attach: function (context) {
$(once('webform-roles', '.js-webform-roles-role[value="authenticated"]', context)).each(function () {
var $authenticated = $(this);
var $checkboxes = $authenticated.parents('.form-checkboxes').find('.js-webform-roles-role').filter(function () {
return ($(this).val() !== 'anonymous' && $(this).val() !== 'authenticated');
});
$authenticated.on('click', function () {
if ($authenticated.is(':checked')) {
$checkboxes.prop('checked', true).attr('disabled', true);
}
else {
$checkboxes.prop('checked', false).removeAttr('disabled');
}
});
if ($authenticated.is(':checked')) {
$checkboxes.prop('checked', true).attr('disabled', true);
}
});
}
};
})(jQuery, Drupal, once);