Interim commit.
[yaffs-website] / web / modules / contrib / ckeditor_templates / js / ckeditor_templates.admin.js
1 /**
2  * @file
3  * CKEditor 'templates' plugin admin behavior.
4  */
5
6 (function ($, Drupal, drupalSettings) {
7
8   'use strict';
9
10   /**
11    * Provides the summary for the "templates" plugin settings vertical tab.
12    *
13    * @type {Drupal~behavior}
14    *
15    * @prop {Drupal~behaviorAttach} attach
16    *   Attaches summary behaviour to the "templates" settings vertical tab.
17    */
18   Drupal.behaviors.ckeditorTemplatesSettingsSummary = {
19     attach: function () {
20       $('[data-ckeditor-plugin-id="templates"]').drupalSetSummary(function (context) {
21         var templatePathValue = $('input[name="editor[settings][plugins][templates][template_path]').val();
22         var replaceContentValue = $('input[name="editor[settings][plugins][templates][replace_content]').is(':checked');
23
24         var templatePathOutput = templatePathValue ? 'Template file overridden.' : 'Default or theme template file.';
25         var replaceContentOutput = replaceContentValue ? '"Replace content" checked' : '"Replace content" unchecked';
26
27         return templatePathOutput + '<br />' + replaceContentOutput;
28       });
29     }
30   };
31
32 })(jQuery, Drupal, drupalSettings);