function editor_ckeditor_library_alter in Editor 7
Implements hook_library_alter().
File
- modules/
editor_ckeditor/ editor_ckeditor.module, line 153 - Adds CKEditor as a supported editor.
Code
function editor_ckeditor_library_alter(&$libraries, $module) {
global $theme;
// Pass Drupal's JS cache-busting string via settings along to CKEditor.
// @see http://docs.ckeditor.com/#!/api/CKEDITOR-property-timestamp
if ($module === 'editor_ckeditor' && isset($libraries['drupal.ckeditor'])) {
$query_string = variable_get('css_js_query_string') ?: '0';
$libraries['drupal.ckeditor']['js'][] = array(
'type' => 'setting',
'data' => array(
'ckeditor' => array(
'timestamp' => $query_string,
),
),
);
}
// A number of core themes have styling issues with the toolbar configurator.
// Add an appropriate 'override' stylesheet to the default administration
// library if one of these themes is enabled.
if ($module == 'editor_ckeditor' && isset($libraries['drupal.editor_ckeditor.admin'])) {
foreach (array(
'garland',
'seven',
'bartik',
) as $core_theme) {
// Only add the override CSS if the theme is available to use.
if ($theme == $core_theme) {
$libraries['drupal.editor_ckeditor.admin']['css'][drupal_get_path('module', 'editor_ckeditor') . "/css/editor_ckeditor.{$core_theme}.admin.css"] = array();
}
}
}
}