0

I'm trying to build a scayt module to be able to use the CKEditor scayt Plugin. I tried to use this module but it did not work for me. https://github.com/nikhildodeja/scayt I created my own but I get a WSOD when I veiw a node creat page. The module is below. What am I doing wrong?

        <?php

    /**
    * @file
    * Definition of \Drupal\scayt\Plugin\CKEditorPlugin\Scayt.
    */

    namespace Drupal\scayt\Plugin\CKEditorPlugin;

    use Drupal\ckeditor\CKEditorPluginBase;
    use Drupal\editor\Entity\Editor;


    /**
    * Defines the "Scayt" plugin.
    *
    * @CKEditorPlugin(
    *   id = "scayt",
    *   label = @Translation("Scayt CKEditor")
    * )
    */

    class Scayt extends CKEditorPluginBase{

    /**
    * Implements \Drupal\scayt\Plugin\CKEditorPluginInterface::getDependencies().
    */
    function getDependencies(Editor $editor) {
    return array('panelbutton','floatpanel','menu','menubutton','dialogui','button');
    }

    /**
    * Implements \Drupal\scayt\Plugin\CKEditorPluginInterface::getLibraries().
    */
    function getLibraries(Editor $editor) {
    return array();
    }

    /**
    * Implements \Drupal\scayt\Plugin\CKEditorPluginInterface::isInternal().
    */
    function isInternal() {
    return FALSE;
    }

    /**
    * Implements \Drupal\scayt\Plugin\CKEditorPluginInterface::getFile().
    */
    function getFile() {
        return 'libraries/scayt/plugin.js';
    }

    /**
    * Implements \Drupal\scayt\Plugin\CKEditorPluginButtonsInterface::getButtons().
    */
    function getButtons() {
    return array(
      'Scayt' => array(
        'label' => t('Spell Check'),
        'image' => 'libraries/scayt/icons/scayt.png',
      ),
    );
    }

    /**
    * Implements \Drupal\scayt\Plugin\CKEditorPluginInterface::getConfig().
    */
    public function getConfig(Editor $editor) {
    return array();
    }
    }
3
  • Going to assume you don't have the Panel Button module + plugin installed. Beyond that you will need to provide error logs.
    – Kevin
    Commented Jun 7, 2017 at 19:22
  • I do have Panel button installed and a few other plugins. watchdog shows no errors. I was able to get the button into the ckeditor toolbar. But after messing with my module I could not load the node create page Commented Jun 7, 2017 at 19:44
  • 1
    If its a WSOD there must be an error log somewhere.
    – Kevin
    Commented Jun 7, 2017 at 19:45

1 Answer 1

0

Without seeing the error it's difficult to know, but you do at least need to extend CKEditorPluginBase rather than PluginBase:

use Drupal\ckeditor\CKEditorPluginBase;

class Scayt extends CKEditorPluginBase implements CKEditorPluginInterface, CKEditorPluginButtonsInterface {

Otherwise the required interface methods won't be satisfied.

5
  • You are right I should use both of these: use Drupal\editor\Entity\Editor; use Drupal\ckeditor\CKEditorPluginBase; Commented Jun 7, 2017 at 21:32
  • I also left out its dependencies: panelbutton','floatpanel','menu','menubutton','dialogui','button Commented Jun 7, 2017 at 21:33
  • I also looked at a Drupal 7 site that has Scayt working and found there are 2 scayt buttons that need to be added. One is called Spell check and the other "Spell Check as You Type" button to your toolbar Commented Jun 7, 2017 at 21:35
  • I got Scayt work. I updated my first post with the code. I am trying now to enable scayt when the node opens? Also in Drupal 8 how can I add ckeditor config like this: config.disableNativeSpellChecker = false; Commented Jun 9, 2017 at 10:49
  • You need to do a combination of things. Check the CKEditor CodeSnippet module for tips on what to do in all of those cases.
    – Kevin
    Commented Oct 20, 2017 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.