Skip to content
Snippets Groups Projects
Commit 4f8eefa7 authored by Devin Carlson's avatar Devin Carlson Committed by Devin Carlson
Browse files

Issue #2463407 by Devin Carlson: Support custom CKEditor icons

parent 97b70ced
Branches 7.x-1.x
No related tags found
No related merge requests found
......@@ -24,11 +24,25 @@ function entity_embed_ckeditor_plugin() {
$buttons = array();
foreach ($embed_buttons as $embed_button) {
// CKEditor only supports icons relative to the plugin path.
// @todo: Figure out how to support custom icons.
$icon = 'entity.png';
$icon_path = FALSE;
// Use a custom icon when available.
if ($fid = $embed_button->button_icon_fid) {
if ($file = file_load($fid)) {
// We are unable to use _entity_embed_button_image() because CKEditor
// requires a specific format for icon paths.
if ($wrapper = file_stream_wrapper_get_instance_by_uri($file->uri)) {
$icon = file_uri_target($file->uri);
$icon_path = base_path() . $wrapper->getDirectoryPath() . '/';
}
}
}
$buttons[$embed_button->name] = array(
'label' => check_plain($embed_button->button_label),
'icon' => 'entity.png',
'icon' => $icon,
'icon_path' => $icon_path,
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment