Version 1
[yaffs-website] / web / modules / contrib / ckeditor_templates / js / ckeditor_templates.admin.js
diff --git a/web/modules/contrib/ckeditor_templates/js/ckeditor_templates.admin.js b/web/modules/contrib/ckeditor_templates/js/ckeditor_templates.admin.js
new file mode 100644 (file)
index 0000000..372e6d8
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * @file
+ * CKEditor 'templates' plugin admin behavior.
+ */
+
+(function ($, Drupal, drupalSettings) {
+
+  'use strict';
+
+  /**
+   * Provides the summary for the "templates" plugin settings vertical tab.
+   *
+   * @type {Drupal~behavior}
+   *
+   * @prop {Drupal~behaviorAttach} attach
+   *   Attaches summary behaviour to the "templates" settings vertical tab.
+   */
+  Drupal.behaviors.ckeditorTemplatesSettingsSummary = {
+    attach: function () {
+      $('[data-ckeditor-plugin-id="templates"]').drupalSetSummary(function (context) {
+        var templatePathValue = $('input[name="editor[settings][plugins][templates][template_path]').val();
+        var replaceContentValue = $('input[name="editor[settings][plugins][templates][replace_content]').is(':checked');
+
+        var templatePathOutput = templatePathValue ? 'Template file overridden.' : 'Default or theme template file.';
+        var replaceContentOutput = replaceContentValue ? '"Replace content" checked' : '"Replace content" unchecked';
+
+        return templatePathOutput + '<br />' + replaceContentOutput;
+      });
+    }
+  };
+
+})(jQuery, Drupal, drupalSettings);