The issue I'm having is very similar to this question, but the solutions here did not work for me.
The steps I took:
- Downloaded the latest version of the oEmbed plugin from https://ckeditor.com/cke4/addon/oembed.
- I extracted the
oembed
directory from the archive and placed that in a custom Drupal module that I already had. This module was used to create simple CKEditor button plugins and worked fine with them. - I went to the configuration page for
basic_html
andfull_html
editors and saw that the oEmbed button was one of the new options (/admin/config/content/formats/manage/basic_html
). - I moved the oEmbed button to the "Active Toolbar" as well as some other custom plugins.
- I went to edit some content where the WYSIWYG would show up
- The other custom buttons showed up, but the oEmbed one did not, despite the fact that I could see it on the config page.
I've tried an older version of the oEmbed plugin from the download page, as well as clearing my cache many times with drush cr
, but still no luck getting it to show up.
What's weird is that when I load the node edit page with the Chrome console open, I can see that the Javascript/CSS for the oEmbed plugin is loading and executing. The button icon though is never requested.
The Drupal Plugin looks like this
namespace Drupal\custom_ckeditor\Plugin\CKEditorPlugin;
/**
* Defines the OEmbed plugin, with CKEditor.
*
* @CKEditorPlugin(
* id = "oembed",
* label = @Translation("OEmbed Plugin")
* )
*/
class OEmbed extends extends PluginBase implements CKEditorPluginInterface, CKEditorPluginButtonsInterface
{
protected $pluginName = 'oembed';
public function getButtons()
{
$iconImage = $this->getIconPath();
return [
'OEmbed' => [
'label' => t('Insert OEmbed'),
'image' => $iconImage,
]
];
}
// Other required functions such as getLibraries() and getDependencies() all return an empty array or false and are omitted from this example.
}
I'm using Drupal 8, with CKEditor v4.7.2.