You are here

public function CodeMirror::isEnabled in CKEditor CodeMirror 8.2

Same name and namespace in other branches
  1. 8 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 90

Class

CodeMirror
Defines the "CodeMirror" plugin.

Namespace

Drupal\ckeditor_codemirror\Plugin\CKEditorPlugin

Code

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