You are here

public function CKEditor::isCompatible in Editor 7

Implements QuickEditInPlaceEditorInterface::isCompatible().

Overrides QuickEditInPlaceEditorInterface::isCompatible

See also

Drupal 8's \Drupal\editor\Plugin\quickedit\editor\Editor::isCompatible().

File

InPlaceEditors/CKEditor.php, line 22

Class

CKEditor
Defines the CKEditor in-place editor.

Code

public function isCompatible(array $instance, array $items) {
  $field = field_info_field($instance['field_name']);

  // This editor is incompatible with multivalued fields.
  if ($field['cardinality'] != 1) {
    return FALSE;
  }
  elseif (!empty($instance['settings']['text_processing'])) {
    $format_id = $items[0]['format'];
    if ($format = filter_format_load($format_id)) {
      editor_format_ensure_additional_properties($format);
      if ($format->editor == 'ckeditor') {
        return TRUE;
      }
    }
    return FALSE;
  }
}