annotate core/modules/ckeditor/src/CKEditorPluginInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\ckeditor;
Chris@0 4
Chris@0 5 use Drupal\Component\Plugin\PluginInspectionInterface;
Chris@0 6 use Drupal\editor\Entity\Editor;
Chris@0 7
Chris@0 8 /**
Chris@0 9 * Defines an interface for (loading of) CKEditor plugins.
Chris@0 10 *
Chris@0 11 * This is the most basic CKEditor plugin interface; it provides the bare
Chris@0 12 * minimum information. Solely implementing this interface is not sufficient to
Chris@0 13 * be able to enable the plugin though — a CKEditor plugin can either be enabled
Chris@0 14 * automatically when a button it provides is present in the toolbar, or when
Chris@0 15 * some programmatically defined condition is true. In the former case,
Chris@0 16 * implement the CKEditorPluginButtonsInterface interface, in the latter case,
Chris@0 17 * implement the CKEditorPluginContextualInterface interface. It is also
Chris@0 18 * possible to implement both, for advanced use cases.
Chris@0 19 *
Chris@0 20 * Finally, if your plugin must be configurable, you can also implement the
Chris@0 21 * CKEditorPluginConfigurableInterface interface.
Chris@0 22 *
Chris@0 23 * @see \Drupal\ckeditor\CKEditorPluginButtonsInterface
Chris@0 24 * @see \Drupal\ckeditor\CKEditorPluginContextualInterface
Chris@0 25 * @see \Drupal\ckeditor\CKEditorPluginConfigurableInterface
Chris@0 26 * @see \Drupal\ckeditor\CKEditorPluginCssInterface
Chris@0 27 * @see \Drupal\ckeditor\CKEditorPluginBase
Chris@0 28 * @see \Drupal\ckeditor\CKEditorPluginManager
Chris@0 29 * @see \Drupal\ckeditor\Annotation\CKEditorPlugin
Chris@0 30 * @see plugin_api
Chris@0 31 */
Chris@0 32 interface CKEditorPluginInterface extends PluginInspectionInterface {
Chris@0 33
Chris@0 34 /**
Chris@0 35 * Indicates if this plugin is part of the optimized CKEditor build.
Chris@0 36 *
Chris@0 37 * Plugins marked as internal are implicitly loaded as part of CKEditor.
Chris@0 38 *
Chris@0 39 * @return bool
Chris@0 40 */
Chris@0 41 public function isInternal();
Chris@0 42
Chris@0 43 /**
Chris@0 44 * Returns a list of plugins this plugin requires.
Chris@0 45 *
Chris@0 46 * @param \Drupal\editor\Entity\Editor $editor
Chris@0 47 * A configured text editor object.
Chris@0 48 * @return array
Chris@0 49 * An unindexed array of plugin names this plugin requires. Each plugin is
Chris@0 50 * is identified by its annotated ID.
Chris@0 51 */
Chris@0 52 public function getDependencies(Editor $editor);
Chris@0 53
Chris@0 54 /**
Chris@0 55 * Returns a list of libraries this plugin requires.
Chris@0 56 *
Chris@0 57 * These libraries will be attached to the text_format element on which the
Chris@0 58 * editor is being loaded.
Chris@0 59 *
Chris@0 60 * @param \Drupal\editor\Entity\Editor $editor
Chris@0 61 * A configured text editor object.
Chris@0 62 * @return array
Chris@0 63 * An array of libraries suitable for usage in a render API #attached
Chris@0 64 * property.
Chris@0 65 */
Chris@0 66 public function getLibraries(Editor $editor);
Chris@0 67
Chris@0 68 /**
Chris@0 69 * Returns the Drupal root-relative file path to the plugin JavaScript file.
Chris@0 70 *
Chris@0 71 * Note: this does not use a Drupal library because this uses CKEditor's API,
Chris@0 72 * see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.resourceManager.html#addExternal.
Chris@0 73 *
Chris@0 74 * @return string|false
Chris@0 75 * The Drupal root-relative path to the file, FALSE if an internal plugin.
Chris@0 76 */
Chris@0 77 public function getFile();
Chris@0 78
Chris@0 79 /**
Chris@0 80 * Returns the additions to CKEDITOR.config for a specific CKEditor instance.
Chris@0 81 *
Chris@0 82 * The editor's settings can be retrieved via $editor->getSettings(), but be
Chris@0 83 * aware that it may not yet contain plugin-specific settings, because the
Chris@0 84 * user may not yet have configured the form.
Chris@0 85 * If there are plugin-specific settings (verify with isset()), they can be
Chris@0 86 * found at
Chris@0 87 * @code
Chris@0 88 * $settings = $editor->getSettings();
Chris@0 89 * $plugin_specific_settings = $settings['plugins'][$plugin_id];
Chris@0 90 * @endcode
Chris@0 91 *
Chris@0 92 * @param \Drupal\editor\Entity\Editor $editor
Chris@0 93 * A configured text editor object.
Chris@0 94 * @return array
Chris@0 95 * A keyed array, whose keys will end up as keys under CKEDITOR.config.
Chris@0 96 */
Chris@0 97 public function getConfig(Editor $editor);
Chris@0 98
Chris@0 99 }