Version 1
[yaffs-website] / vendor / drupal / console / templates / module / src / Plugin / CKEditorPlugin / ckeditorbutton.php.twig
diff --git a/vendor/drupal/console/templates/module/src/Plugin/CKEditorPlugin/ckeditorbutton.php.twig b/vendor/drupal/console/templates/module/src/Plugin/CKEditorPlugin/ckeditorbutton.php.twig
new file mode 100644 (file)
index 0000000..0e16747
--- /dev/null
@@ -0,0 +1,86 @@
+{% extends "base/class.php.twig" %}
+
+{% block file_path %}
+\Drupal\{{ module }}\Plugin\CKEditorPlugin\{{ class_name }}.
+{% endblock %}
+
+{% block namespace_class %}
+namespace Drupal\{{ module }}\Plugin\CKEditorPlugin;
+{% endblock %}
+
+{% block use_class %}
+use Drupal\ckeditor\CKEditorPluginBase;
+use Drupal\editor\Entity\Editor;
+{% endblock %}
+
+{% block class_declaration %}
+/**
+ * Defines the "{{ plugin_id }}" plugin.
+ *
+ * NOTE: The plugin ID ('id' key) corresponds to the CKEditor plugin name.
+ * It is the first argument of the CKEDITOR.plugins.add() function in the
+ * plugin.js file.
+ *
+ * @CKEditorPlugin(
+ *   id = "{{ plugin_id }}",
+ *   label = @Translation("{{ label }}")
+ * )
+ */
+class {{ class_name }} extends CKEditorPluginBase {% endblock %}
+{% block class_methods %}
+
+  /**
+   * {@inheritdoc}
+   *
+   * NOTE: The keys of the returned array corresponds to the CKEditor button
+   * names. They are the first argument of the editor.ui.addButton() or
+   * editor.ui.addRichCombo() functions in the plugin.js file.
+   */
+  public function getButtons() {
+    // Make sure that the path to the image matches the file structure of
+    // the CKEditor plugin you are implementing.
+    return [
+      '{{ button_name }}' => [
+        'label' => t('{{ label }}'),
+        'image' => '{{ button_icon_path }}',
+      ],
+    ];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFile() {
+    // Make sure that the path to the plugin.js matches the file structure of
+    // the CKEditor plugin you are implementing.
+    return drupal_get_path('module', '{{ module }}') . '/js/plugins/{{ plugin_id }}/plugin.js';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isInternal() {
+    return FALSE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDependencies(Editor $editor) {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getLibraries(Editor $editor) {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getConfig(Editor $editor) {
+    return [];
+  }
+{% endblock %}