Commit 0cd1b1a0 authored by Henri MEDOT's avatar Henri MEDOT
Browse files

Fixed: when trying to revert a menu link path, no language may also mean default language.

Filled README.txt
parent faa3c277
......@@ -3,8 +3,52 @@ http://drupal.org/project/ckeditor_link
REQUIREMENTS
The CKEditor module or the Wysiwyg module
The CKEditor editor
Clean URLs need to be enabled.
INSTALLATION
Please read instructions at: http://drupal.org/project/ckeditor_link
Copy the ckeditor_link folder to your sites/all/modules directory.
Go to admin/build/modules and enable the module.
*Set permissions*
Go to admin/user/permissions and grant the CKEditor Link related permissions to
the desired roles.
*When using the CKEditor module*
Go to admin/settings/ckeditor and edit the desired profile.
Under "Editor appearance" > "Plugins", check the "CKEditor Link" box.
Save changes.
*When using the Wysiwyg module*
Go to admin/settings/wysiwyg and edit the CKEditor profile.
Under "Buttons and plugins", check both "Link" and "CKEditor Link" boxes.
Save changes.
*Set up CKEditor Link Filter*
Go to admin/settings/filters and edit the desired input format.
Check the "CKEditor Link Filter" box.
Save changes.
If you use other path converting filters like Pathologic or Path Filter, make
sure that CKEditor Link Filter comes before them:
Edit the input format again.
Click on the "Rearrange" tab.
Drag and drop CKEditor Link Filter before these filters in the list.
Save changes.
*Configure CKEditor Link*
Go to admin/settings/ckeditor_link.
Change settings as desired.
Save changes.
EXTENDING CKEDITOR LINK
Developers, see the ckeditor_link.api.php file.
......
......@@ -77,6 +77,8 @@ function hook_ckeditor_link_autocomplete_alter(&$results, $string) {
/**
* Revert a path to a user-friendly title.
*
* Implementing modules should revert only paths the current user has access to.
*
* @param $path
* The path to revert.
* @param $langcode
......
......@@ -49,6 +49,7 @@ function ckeditor_link_ckeditor_link_i18nmenu_revert($path, &$langcode) {
$router_item = menu_get_item($path);
if ($router_item && $router_item['access']) {
$result = db_query("SELECT mlid, link_title, options FROM {menu_links} WHERE link_path = '%s' AND hidden = 0 ORDER BY customized DESC", $path);
$default_langcode = language_default('language');
$link_title = NULL;
while ($item = db_fetch_object($result)) {
$options = unserialize($item->options);
......@@ -57,6 +58,11 @@ function ckeditor_link_ckeditor_link_i18nmenu_revert($path, &$langcode) {
$link_title = $item->link_title;
break;
}
elseif (($item_langcode == $default_langcode) && empty($langcode)) {
$langcode = $default_langcode;
$link_title = $item->link_title;
break;
}
elseif (!$link_title && empty($item_langcode)) {
$link_title = i18nstrings('menu:item:'. $item->mlid .':title', $item->link_title, $langcode);
}
......
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