Commit 2f1c2bcd authored by Henri MEDOT's avatar Henri MEDOT
Browse files

Issue #1280978 by KeyboardCowboy, anrikun: Settings form throws error if menu module disabled.

Minor improvement in ckeditor_link_ckeditor_link_file_url()
parent 3cd78557
......@@ -9,8 +9,7 @@
* Implementation of hook_ckeditor_link_TYPE_url().
*/
function ckeditor_link_ckeditor_link_file_url($path, $langcode) {
$file_path = file_directory_path();
if (substr($path, 0, strlen($file_path)) == $file_path) {
if (strpos($path, file_directory_path() .'/') === 0) {
return file_create_url($path);
}
}
......@@ -59,17 +59,21 @@ function ckeditor_link_ckeditor_link_menu_revert($path, &$langcode) {
* Implementation of hook_ckeditor_link_TYPE_settings().
*/
function ckeditor_link_ckeditor_link_menu_settings() {
$form['menu'] = array(
'#type' => 'fieldset',
'#title' => t('Menu items'),
);
$form['menu']['ckeditor_link_autocomplete_menus'] = array(
'#type' => 'checkboxes',
'#title' => t('Menus'),
'#options' => array('- any -' => t('<em>Any menu</em>')) + array_map('check_plain', menu_get_menus()),
'#default_value' => variable_get('ckeditor_link_autocomplete_menus', array()),
'#description' => t('Select the menus to be available as autocomplete suggestions.'),
);
$form = array();
if (module_exists('menu')) {
$form['menu'] = array(
'#type' => 'fieldset',
'#title' => t('Menu items'),
);
$form['menu']['ckeditor_link_autocomplete_menus'] = array(
'#type' => 'checkboxes',
'#title' => t('Menus'),
'#options' => array('- any -' => t('<em>Any menu</em>')) + array_map('check_plain', menu_get_menus()),
'#default_value' => variable_get('ckeditor_link_autocomplete_menus', array()),
'#description' => t('Select the menus to be available as autocomplete suggestions.'),
);
}
return $form;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment