diff --git a/ckeditor.module b/ckeditor.module index 450fc7c..9e2be84 100644 --- a/ckeditor.module +++ b/ckeditor.module @@ -361,14 +361,22 @@ function ckeditor_module_path($mode = 'relative') { * Path of library in the Drupal installation. */ function ckeditor_library_path($mode = 'relative') { + $lib_path = 'sites/all/libraries'; + + if (function_exists('libraries_get_path')) { + $path = libraries_get_path('ckeditor'); + if ($path !== FALSE) { + $lib_path = drupal_substr($path, 0, strlen($path) - 9); + } + } switch ($mode) { default: case 'relative': - return ckeditor_base_path('relative') . '/sites/all/libraries'; + return ckeditor_base_path('relative') . '/' . $lib_path; case 'local': - return ckeditor_base_path('local') . '/sites/all/libraries'; + return ckeditor_base_path('local') . '/' . $lib_path; case 'url': - return 'sites/all/libraries'; + return $lib_path; } } @@ -602,6 +610,10 @@ function ckeditor_file_download($uri) { * Enable disabled plugins by hook_modules_disabled(). */ function ckeditor_modules_enabled($modules) { + if (in_array('libraries', $modules)) { + // Check and update path to CKEditor in the global profile + _ckeditor_requirements_isinstalled(); + } module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib'); $profiles_list = ckeditor_profile_input_formats(); $plugins_list = ckeditor_load_plugins(); @@ -684,4 +696,4 @@ function ckeditor_modules_uninstalled($modules) { ->execute(); } } -} \ No newline at end of file +} diff --git a/includes/ckeditor.lib.inc b/includes/ckeditor.lib.inc index 5d55f39..4fa5d68 100644 --- a/includes/ckeditor.lib.inc +++ b/includes/ckeditor.lib.inc @@ -655,7 +655,7 @@ function _ckeditor_script_path() { elseif (file_exists($module_path . '/ckeditor/ckeditor/ckeditor.js')) { $jspath = '%m/ckeditor/ckeditor'; } - elseif (file_exists('sites/all/libraries/ckeditor/ckeditor.js')) { + elseif (file_exists(ckeditor_library_path('url') . '/ckeditor/ckeditor.js')) { $jspath = '%l/ckeditor'; } return $jspath;