function insert_editor_js_settings_alter in Insert 8.2
Same name and namespace in other branches
- 8 insert.module \insert_editor_js_settings_alter()
Implements hook_editor_js_settings_alter().
File
- ./
insert.module, line 808
Code
function insert_editor_js_settings_alter(array &$settings) {
InsertUtility::addEditorExtraAllowedContent($settings, [
'img[src,width,height,alt,title,data-insert-class,data-insert-type,data-insert-attach](*)',
'span[contenteditable,data-insert-type,data-insert-attach](*)',
'a[title,type,data-insert-type,data-insert-attach](*)',
'div[data-insert-attach]',
'audio[contenteditable,controls,src,type,data-insert-attach]',
'video[contenteditable,controls,src,type,data-insert-attach]',
]);
foreach (array_keys($settings['editor']['formats']) as $text_format_id) {
if (!isset($settings['editor']['formats'][$text_format_id]['editorSettings'])) {
continue;
}
// If drupalimage is disabled (the editor's image button is removed),
// still, CKEditor's naive image2 plugin wraps the image in a span tag
// blocking from applying a style to the image making it impossible to set
// alignment on the image. Therefore, the image2 plugin needs to be disabled
// in that case.
// With drupalimage enabled, the user has to set alignment using the
// editor's image button; With drupalimage disabled, the user has to set
// alignment using the styles drop-down which allows applying additional
// styles to images as well.
if (!in_array('drupalimage', array_keys($settings['editor']['formats'][$text_format_id]['editorSettings']['drupalExternalPlugins']))) {
$settings['editor']['formats'][$text_format_id]['editorSettings']['removePlugins'] = 'image2';
}
}
}