3 * Attaches behavior for the Filter module.
6 (function ($, Drupal) {
11 * Displays the guidelines of the selected text format automatically.
13 * @type {Drupal~behavior}
15 * @prop {Drupal~behaviorAttach} attach
16 * Attaches behavior for updating filter guidelines.
18 Drupal.behaviors.filterGuidelines = {
19 attach: function (context) {
21 function updateFilterGuidelines(event) {
22 var $this = $(event.target);
23 var value = $this.val();
24 $this.closest('.filter-wrapper')
25 .find('.filter-guidelines-item').hide()
26 .filter('.filter-guidelines-' + value).show();
29 $(context).find('.filter-guidelines').once('filter-guidelines')
30 .find(':header').hide()
31 .closest('.filter-wrapper').find('select.filter-list')
32 .on('change.filterGuidelines', updateFilterGuidelines)
33 // Need to trigger the namespaced event to avoid triggering formUpdated
34 // when initializing the select.
35 .trigger('change.filterGuidelines');