3 namespace Drupal\editor\Plugin;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\Core\Plugin\PluginBase;
7 use Drupal\editor\Entity\Editor;
10 * Defines a base class from which other modules providing editors may extend.
12 * This class provides default implementations of the EditorPluginInterface so
13 * that classes extending this one do not need to implement every method.
15 * Plugins extending this class need to specify an annotation containing the
16 * plugin definition so the plugin can be discovered.
18 * @see \Drupal\editor\Annotation\Editor
19 * @see \Drupal\editor\Plugin\EditorPluginInterface
20 * @see \Drupal\editor\Plugin\EditorManager
23 abstract class EditorBase extends PluginBase implements EditorPluginInterface {
28 public function getDefaultSettings() {
35 * @todo Remove in Drupal 9.0.0.
37 public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
38 @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.3.x and will be removed in 9.0.0.', E_USER_DEPRECATED);
45 * @todo Remove in Drupal 9.0.0.
47 public function settingsFormValidate(array $form, FormStateInterface $form_state) {
48 @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.3.x and will be removed in 9.0.0.', E_USER_DEPRECATED);
54 * @todo Remove in Drupal 9.0.0.
56 public function settingsFormSubmit(array $form, FormStateInterface $form_state) {
57 @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 8.3.x and will be removed in 9.0.0.', E_USER_DEPRECATED);
63 public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
64 return $this->settingsForm($form, $form_state, $form_state->get('editor'));
70 public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
71 return $this->settingsFormValidate($form, $form_state);
77 public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
78 return $this->settingsFormSubmit($form, $form_state);