"Fossies" - the Fresh Open Source Software Archive

Member "drupal-9.1.0-rc1/core/modules/ckeditor/src/CKEditorPluginInterface.php" (18 Nov 2020, 3582 Bytes) of package /linux/www/drupal-9.1.0-rc1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "CKEditorPluginInterface.php" see the Fossies "Dox" file reference documentation.

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