CKEditor.php in Editor 7
File
InPlaceEditors/CKEditor.php
View source
<?php
module_load_include('php', 'quickedit', 'includes/QuickEditInPlaceEditorInterface');
class CKEditor implements QuickEditInPlaceEditorInterface {
public function isCompatible(array $instance, array $items) {
$field = field_info_field($instance['field_name']);
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;
}
}
public function getMetadata(array $instance, array $items) {
$format_id = $items[0]['format'];
$metadata['format'] = $format_id;
$metadata['formatHasTransformations'] = (bool) count(array_intersect(array(
FILTER_TYPE_TRANSFORM_REVERSIBLE,
FILTER_TYPE_TRANSFORM_IRREVERSIBLE,
), filter_get_filter_types_by_format($format_id)));
return $metadata;
}
public function getAttachments() {
global $user;
$formats = filter_formats($user);
$settings = editor_get_attached($formats);
$settings['library'][] = array(
'editor',
'quickedit.inPlaceEditor.formattedText',
);
$settings['js'][] = array(
'type' => 'setting',
'data' => array(
'quickedit' => array(
'ckeditor' => array(
'basePath' => base_path() . drupal_get_path('module', 'editor_ckeditor') . '/lib/ckeditor/',
),
),
),
);
return $settings;
}
}
Classes
Name |
Description |
CKEditor |
Defines the CKEditor in-place editor. |