3 namespace Drupal\editor_test\Plugin\Editor;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\editor\Entity\Editor;
7 use Drupal\editor\Plugin\EditorBase;
10 * Defines a Unicorn-powered text editor for Drupal (for testing purposes).
14 * label = @Translation("Unicorn Editor"),
15 * supports_content_filtering = TRUE,
16 * supports_inline_editing = TRUE,
17 * is_xss_safe = FALSE,
18 * supported_element_types = {
24 class UnicornEditor extends EditorBase {
29 public function getDefaultSettings() {
30 return ['ponies_too' => TRUE];
36 public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
37 $form['ponies_too'] = [
38 '#title' => t('Pony mode'),
39 '#type' => 'checkbox',
40 '#default_value' => TRUE,
48 public function getJSSettings(Editor $editor) {
50 $settings = $editor->getSettings();
51 if ($settings['ponies_too']) {
52 $js_settings['ponyModeEnabled'] = TRUE;
60 public function getLibraries(Editor $editor) {
62 'editor_test/unicorn',