3 * Language admin behavior.
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.
25 .closest('.table-language-group')
26 .find('table, .tabledrag-toggle-weight')
27 .toggle($checkbox.prop('checked'));
30 // Bind hide/show and rearrange customization checkboxes.
32 .once('negotiation-language-admin-bind')
33 .on('change', inputSelector, event => {
34 toggleTable(event.target);
36 // Initially, hide language detection types that are not customized.
38 .find(`${inputSelector}:not(:checked)`)
39 .each((index, element) => {