You are here

interface GutenbergPluginInterface in Gutenberg 8.2

Same name and namespace in other branches
  1. 8 src/GutenbergPluginInterface.php \Drupal\gutenberg\GutenbergPluginInterface

Defines an interface for (loading of) Gutenberg plugins.

Hierarchy

Expanded class hierarchy of GutenbergPluginInterface

All classes that implement GutenbergPluginInterface

File

src/GutenbergPluginInterface.php, line 11

Namespace

Drupal\gutenberg
View source
interface GutenbergPluginInterface extends PluginInspectionInterface {

  /**
   * Returns a list of libraries this plugin requires.
   *
   * These libraries will be attached to the text_format element on which the
   * editor is being loaded.
   *
   * @param \Drupal\editor\Entity\Editor $editor
   *   A configured text editor object.
   *
   * @return array
   *   An array of libraries suitable for usage in a render API #attached
   *   property.
   */
  public function getLibraries(Editor $editor);

  /**
   * Returns the Drupal root-relative file path to the plugin JavaScript file.
   *
   * Note: this does not use a Drupal library because this uses CKEditor's API,
   * see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.resourceManager.html#addExternal.
   *
   * @return string|false
   *   The Drupal root-relative path to the file, FALSE if an internal plugin.
   */
  public function getFile();

  /**
   * Returns the additions to CKEDITOR.config for a specific CKEditor instance.
   *
   * The editor's settings can be retrieved via $editor->getSettings(), but be
   * aware that it may not yet contain plugin-specific settings, because the
   * user may not yet have configured the form.
   * If there are plugin-specific settings (verify with isset()), they can be
   * found at:
   * @code
   * $settings = $editor->getSettings();
   * $plugin_specific_settings = $settings['plugins'][$plugin_id];
   * @endcode
   *
   * @param \Drupal\editor\Entity\Editor $editor
   *   A configured text editor object.
   *
   * @return array
   *   A keyed array, whose keys will end up as keys under CKEDITOR.config.
   */
  public function getConfig(Editor $editor);

}

Members

Namesort descending Modifiers Type Description Overrides
GutenbergPluginInterface::getConfig public function Returns the additions to CKEDITOR.config for a specific CKEditor instance. 1
GutenbergPluginInterface::getFile public function Returns the Drupal root-relative file path to the plugin JavaScript file. 1
GutenbergPluginInterface::getLibraries public function Returns a list of libraries this plugin requires. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2