0

I am using Drupal 8 and having custom ckeditor module where I am adding plugins. I have downloaded iframe and fakeobjects addon and placed in the libraries folder.

Then in my custom module, under custom_module/src/Plugin/CKEditorplugin/, I have added custom_IFrame.php and in getFile() function, added libraries/iframe/plugin.js.

For fakeobjects, under custom_module/src/Plugin/CKEditorplugin/, I have added custom_fakeobjects.php and in getFile() function, added libraries/fakeobjects/plugin.js.

In front-end, when I open the editor, I got the error:

Uncaught Error: [CKEDITOR.resourceManager.load] Resource name "fakeobjects" was not found at "https://mysite/core/assets/vendor/ckeditor/plugins/fakeobjects/plugin.js?t=pe0uj4".

in Iframe addon plugin.js file, requires: 'dialog,fakeobjects' is the requirements. Hence I need to add fakeobjects but it is checking only in core and not in my custom module.

When I do view-source, then I am able to see libraries/iframe/plugin.js has been loaded but libraries/fakeobjects/plugin.js has not been loaded.

My Custom Fakeobjects code:

<?php

namespace Drupal\custom_ckeditor\Plugin\CKEditorPlugin;

use Drupal\editor\Entity\Editor;

use Drupal\ckeditor\CKEditorPluginBase;

/**
 * Defines the "fakeobjects" plugin.
 *
 * @CKEditorPlugin(
 *   id = "fakeobjects",
 *   label = @Translation("CKEditor fakeobjects button"),
 *   module = "custom_ckeditor"
 * )
 */
class CustomFakeObjects extends CKEditorPluginBase {

public function getDependencies(Editor $editor) {

    return ['fakeobjects'];

  }

  /**
   * Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile().
   */

  public function getFile() {

       return 'libraries/fakeobjects/plugin.js';

  }


  /**
   * {@inheritdoc}
   */

  public function getButtons() {

    return [];

  }


  /**
   * {@inheritdoc}
   */

  public function getConfig(Editor $editor) {

    return [];

  }


}

If I add getDependencies(), there is no error but iframe icon is not showing up in the editor

  • 1
    Welcome to Drupal Answers. Unfortunately, it's not possible for us to guess what's going wrong with your code, when you don't share it. For getting a good answer, please add your CKEditorPlugin source code. – Mario Steinitz Aug 25 '18 at 15:44
  • It also helps a lot to articulate a real question. – leymannx Aug 25 '18 at 20:52
  • Edited my question, please have a look – Sivagami Natarajan Aug 26 '18 at 2:46
  • It will be usefull if someone gives clue how to add iframe from ckeditor.com/cke4/addon/iframe with dependency fakeobjects in drupal8 ckeditor – Sivagami Natarajan Aug 26 '18 at 6:54

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.