@@ -471,7 +471,7 @@ function _shortcut_link_form_elements($shortcut_link = NULL) {
|
||||
);
|
||||
}
|
||||
else {
|
||||
$shortcut_link['link_path'] = drupal_get_path_alias($shortcut_link['link_path']);
|
||||
$shortcut_link['link_path'] = ($shortcut_link['link_path'] == '<front>') ? '' : drupal_get_path_alias($shortcut_link['link_path']);
|
||||
}
|
||||
|
||||
$form['shortcut_link']['#tree'] = TRUE;
|
||||
@@ -520,7 +520,11 @@ function shortcut_link_edit_validate($form, &$form_state) {
|
||||
*/
|
||||
function shortcut_link_edit_submit($form, &$form_state) {
|
||||
// Normalize the path in case it is an alias.
|
||||
$form_state['values']['shortcut_link']['link_path'] = drupal_get_normal_path($form_state['values']['shortcut_link']['link_path']);
|
||||
$shortcut_path = drupal_get_normal_path($form_state['values']['shortcut_link']['link_path']);
|
||||
if (empty($shortcut_path)) {
|
||||
$shortcut_path = '<front>';
|
||||
}
|
||||
$form_state['values']['shortcut_link']['link_path'] = $shortcut_path;
|
||||
|
||||
$shortcut_link = array_merge($form_state['values']['original_shortcut_link'], $form_state['values']['shortcut_link']);
|
||||
|
||||
@@ -577,6 +581,9 @@ function shortcut_admin_add_link($shortcut_link, &$shortcut_set, $limit = NULL)
|
||||
|
||||
// Normalize the path in case it is an alias.
|
||||
$shortcut_link['link_path'] = drupal_get_normal_path($shortcut_link['link_path']);
|
||||
if (empty($shortcut_link['link_path'])) {
|
||||
$shortcut_link['link_path'] = '<front>';
|
||||
}
|
||||
|
||||
// Add the link to the end of the list.
|
||||
$shortcut_set->links[] = $shortcut_link;
|
||||
|
@@ -50,7 +50,7 @@ Drupal.behaviors.shortcutDrag = {
|
||||
// the tableDrag system. However, the row that swapped with it
|
||||
// has moved to the "disabled" section, so we need to force its
|
||||
// status to be disabled and mark it also as changed.
|
||||
var changedRowObject = new tableDrag.row(changedRow, 'mouse', self.indentEnabled, self.maxDepth, true);
|
||||
var changedRowObject = new tableDrag.row(changedRow, 'mouse', false, 0, true);
|
||||
changedRowObject.markChanged();
|
||||
tableDrag.rowStatusChange(changedRowObject);
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = shortcut.test
|
||||
configure = admin/config/user-interface/shortcut
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-10-17
|
||||
version = "7.16"
|
||||
; Information added by drupal.org packaging script on 2012-11-07
|
||||
version = "7.17"
|
||||
project = "drupal"
|
||||
datestamp = "1350508567"
|
||||
datestamp = "1352325357"
|
||||
|
||||
|
@@ -86,7 +86,7 @@ function shortcut_menu() {
|
||||
'title' => 'Edit shortcuts',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('shortcut_set_customize', 4),
|
||||
'title callback' => 'shortcut_set_title',
|
||||
'title callback' => 'shortcut_set_title_callback',
|
||||
'title arguments' => array(4),
|
||||
'access callback' => 'shortcut_set_edit_access',
|
||||
'access arguments' => array(4),
|
||||
@@ -617,8 +617,8 @@ function shortcut_valid_link($path) {
|
||||
if ($path != $normal_path) {
|
||||
$path = $normal_path;
|
||||
}
|
||||
// Only accept links that correspond to valid paths on the site itself.
|
||||
return !url_is_external($path) && menu_get_item($path);
|
||||
// An empty path is valid too and will be converted to <front>.
|
||||
return (!url_is_external($path) && menu_get_item($path)) || empty($path) || $path == '<front>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -735,9 +735,15 @@ function shortcut_toolbar_pre_render($toolbar) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of a shortcut set.
|
||||
* Returns the sanitized title of a shortcut set.
|
||||
*
|
||||
* Title callback for the editing pages for shortcut sets.
|
||||
* Deprecated. This function was previously used as a menu item title callback
|
||||
* but has been replaced by shortcut_set_title_callback() (which does not
|
||||
* sanitize the title, since the menu system does that automatically). In
|
||||
* Drupal 7, use that function for title callbacks, and call check_plain()
|
||||
* directly if you need a sanitized title. In Drupal 8, this function will be
|
||||
* restored as a title callback and therefore will no longer sanitize its
|
||||
* output.
|
||||
*
|
||||
* @param $shortcut_set
|
||||
* An object representing the shortcut set, as returned by
|
||||
@@ -747,3 +753,15 @@ function shortcut_set_title($shortcut_set) {
|
||||
return check_plain($shortcut_set->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of a shortcut set.
|
||||
*
|
||||
* Title callback for the editing pages for shortcut sets.
|
||||
*
|
||||
* @param $shortcut_set
|
||||
* An object representing the shortcut set, as returned by
|
||||
* shortcut_set_load().
|
||||
*/
|
||||
function shortcut_set_title_callback($shortcut_set) {
|
||||
return $shortcut_set->title;
|
||||
}
|
||||
|
@@ -124,6 +124,7 @@ class ShortcutLinksTestCase extends ShortcutTestCase {
|
||||
|
||||
// Create some paths to test.
|
||||
$test_cases = array(
|
||||
array('path' => ''),
|
||||
array('path' => 'admin'),
|
||||
array('path' => 'admin/config/system/site-information'),
|
||||
array('path' => "node/{$this->node->nid}/edit"),
|
||||
@@ -141,7 +142,8 @@ class ShortcutLinksTestCase extends ShortcutTestCase {
|
||||
$this->assertResponse(200);
|
||||
$saved_set = shortcut_set_load($set->set_name);
|
||||
$paths = $this->getShortcutInformation($saved_set, 'link_path');
|
||||
$this->assertTrue(in_array(drupal_get_normal_path($test['path']), $paths), 'Shortcut created: '. $test['path']);
|
||||
$test_path = empty($test['path']) ? '<front>' : $test['path'];
|
||||
$this->assertTrue(in_array(drupal_get_normal_path($test_path), $paths), 'Shortcut created: '. $test['path']);
|
||||
$this->assertLink($title, 0, 'Shortcut link found on the page.');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user