EditorPluginInterface
interface EditorPluginInterface implements PluginInspectionInterface, PluginFormInterface (View source)
Defines an interface for configurable text editors.
Modules implementing this interface may want to extend the EditorBase class, which provides default implementations of each method where appropriate.
If the editor's behavior depends on extensive options and/or external data, then the implementing module can choose to provide a separate, global configuration page rather than per-text-format settings. In that case, this form should provide a link to the separate settings page.
Methods
Gets the definition of the plugin implementation.
Returns the default settings for this configurable text editor.
Details
string
getPluginId()
Gets the plugin_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
array
buildConfigurationForm(array $form, FormStateInterface $form_state)
Form constructor.
Plugin forms are embedded in other forms. In order to know where the plugin form is located in the parent form, #parents and #array_parents must be known, but these are not available during the initial build phase. In order to have these properties available when building the plugin form's elements, let this method return a form element that has a #process callback and build the rest of the form in the callback. By the time the callback is executed, the element's #parents and #array_parents properties will have been set by the form API. For more documentation on #parents and
array_parents, see \Drupal\Core\Render\Element\FormElement.
validateConfigurationForm(array $form, FormStateInterface $form_state)
Form validation handler.
submitConfigurationForm(array $form, FormStateInterface $form_state)
Form submission handler.
array
getDefaultSettings()
Returns the default settings for this configurable text editor.
array
getJSSettings(Editor $editor)
Returns JavaScript settings to be attached.
Most text editors use JavaScript to provide a WYSIWYG or toolbar on the client-side interface. This method can be used to convert internal settings of the text editor into JavaScript variables that will be accessible when the text editor is loaded.
array
getLibraries(Editor $editor)
Returns libraries to be attached.
Because this is a method, plugins can dynamically choose to attach a different library for different configurations, instead of being forced to always use the same method.