3 * Language admin behavior.
6 (function ($, Drupal) {
8 * Makes language negotiation inherit user interface negotiation.
10 * @type {Drupal~behavior}
12 * @prop {Drupal~behaviorAttach} attach
13 * Attach behavior to language negotiation admin user interface.
15 Drupal.behaviors.negotiationLanguage = {
17 const $configForm = $('#language-negotiation-configure-form');
18 const inputSelector = 'input[name$="[configurable]"]';
19 // Given a customization checkbox derive the language type being changed.
20 function toggleTable(checkbox) {
21 const $checkbox = $(checkbox);
22 // Get the language detection type such as Interface text language
23 // detection or Content language detection.
24 $checkbox.closest('.table-language-group')
25 .find('table, .tabledrag-toggle-weight')
26 .toggle($checkbox.prop('checked'));
29 // Bind hide/show and rearrange customization checkboxes.
30 $configForm.once('negotiation-language-admin-bind').on('change', inputSelector, (event) => {
31 toggleTable(event.target);
33 // Initially, hide language detection types that are not customized.
34 $configForm.find(`${inputSelector}:not(:checked)`).each((index, element) => {