Commit 7d087da1 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 171d844e
......@@ -10,7 +10,7 @@
*/
function ckeditor_link_ckeditor_link_file_url($path, $langcode) {
$file_path = variable_get('file_public_path', conf_path() .'/files');
if (substr($path, 0, strlen($file_path)) == $file_path) {
if (strpos($path, $file_path .'/') === 0) {
return file_create_url($path);
}
}
......@@ -63,17 +63,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