comparison core/modules/language/language.admin.es6.js @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
1 /** 1 /**
2 * @file 2 * @file
3 * Language admin behavior. 3 * Language admin behavior.
4 */ 4 */
5 5
6 (function ($, Drupal) { 6 (function($, Drupal) {
7 /** 7 /**
8 * Makes language negotiation inherit user interface negotiation. 8 * Makes language negotiation inherit user interface negotiation.
9 * 9 *
10 * @type {Drupal~behavior} 10 * @type {Drupal~behavior}
11 * 11 *
19 // Given a customization checkbox derive the language type being changed. 19 // Given a customization checkbox derive the language type being changed.
20 function toggleTable(checkbox) { 20 function toggleTable(checkbox) {
21 const $checkbox = $(checkbox); 21 const $checkbox = $(checkbox);
22 // Get the language detection type such as Interface text language 22 // Get the language detection type such as Interface text language
23 // detection or Content language detection. 23 // detection or Content language detection.
24 $checkbox.closest('.table-language-group') 24 $checkbox
25 .closest('.table-language-group')
25 .find('table, .tabledrag-toggle-weight') 26 .find('table, .tabledrag-toggle-weight')
26 .toggle($checkbox.prop('checked')); 27 .toggle($checkbox.prop('checked'));
27 } 28 }
28 29
29 // Bind hide/show and rearrange customization checkboxes. 30 // Bind hide/show and rearrange customization checkboxes.
30 $configForm.once('negotiation-language-admin-bind').on('change', inputSelector, (event) => { 31 $configForm
31 toggleTable(event.target); 32 .once('negotiation-language-admin-bind')
32 }); 33 .on('change', inputSelector, event => {
34 toggleTable(event.target);
35 });
33 // Initially, hide language detection types that are not customized. 36 // Initially, hide language detection types that are not customized.
34 $configForm.find(`${inputSelector}:not(:checked)`).each((index, element) => { 37 $configForm
35 toggleTable(element); 38 .find(`${inputSelector}:not(:checked)`)
36 }); 39 .each((index, element) => {
40 toggleTable(element);
41 });
37 }, 42 },
38 }; 43 };
39 }(jQuery, Drupal)); 44 })(jQuery, Drupal);