You are here

public function CodeMirror::isEnabled in CKEditor CodeMirror 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/CKEditorPlugin/CodeMirror.php \Drupal\ckeditor_codemirror\Plugin\CKEditorPlugin\CodeMirror::isEnabled()

Checks if this plugin should be enabled based on the editor configuration.

The editor's settings can be retrieved via $editor->getSettings().

Parameters

\Drupal\editor\Entity\Editor $editor: A configured text editor object.

Return value

bool

Overrides CKEditorPluginContextualInterface::isEnabled

File

src/Plugin/CKEditorPlugin/CodeMirror.php, line 60

Class

CodeMirror
Defines the "CodeMirror" plugin.

Namespace

Drupal\ckeditor_codemirror\Plugin\CKEditorPlugin

Code

public function isEnabled(Editor $editor) {
  $settings = $editor
    ->getSettings();
  if (isset($settings['plugins']['codemirror'])) {
    return $editor
      ->getSettings()['plugins']['codemirror']['enable'];
  }
  return FALSE;
}