You are here

public function EditorAdvancedImage::isEnabled in Editor Advanced Image 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/CKEditorPlugin/EditorAdvancedImage.php \Drupal\editor_advanced_image\Plugin\CKEditorPlugin\EditorAdvancedImage::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/EditorAdvancedImage.php, line 91

Class

EditorAdvancedImage
Defines the "editoradvancedimage" plugin.

Namespace

Drupal\editor_advanced_image\Plugin\CKEditorPlugin

Code

public function isEnabled(Editor $editor) {

  // Check if a DrupalImage has been placed in the CKeditor.
  $settings = $editor
    ->getSettings();
  if ($this
    ->checkImageEnable($settings['toolbar']['rows'][0])) {
    return TRUE;
  }
  return FALSE;
}