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