function DrupalMedia::isEnabled

Same name in other branches
  1. 8.9.x core/modules/media/src/Plugin/CKEditorPlugin/DrupalMedia.php \Drupal\media\Plugin\CKEditorPlugin\DrupalMedia::isEnabled()

Overrides CKEditorPluginContextualInterface::isEnabled

File

core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalMedia.php, line 113

Class

DrupalMedia
Defines the "drupalmedia" plugin.

Namespace

Drupal\ckeditor\Plugin\CKEditorPlugin

Code

public function isEnabled(Editor $editor) {
    if (!$editor->hasAssociatedFilterFormat()) {
        return FALSE;
    }
    // Automatically enable this plugin if the text format associated with this
    // text editor uses the media_embed filter.
    $filters = $editor->getFilterFormat()
        ->filters();
    return $filters->has('media_embed') && $filters->get('media_embed')->status;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.