Problem/Motivation

http://drupal.org/node/1344752 issue talks about Drag and Drop issue and the swapped element is not marked as changed.
There should be validation at the server side, even though JS does not respect the limit, at server side the code should limit.

Steps to reproduce the issue.

  1. Create shortcuts more than 8, lets say 9. When you add more than 7 shortcuts, the 7th menu will be replaced by the new, and the old menu will be added disabled section.
  2. Go to Edit Shortcuts
  3. Drag all the shortcuts from Disabled to Enabled. When u drag and drop, it appears that Enabled section always have 7.
  4. Save
  5. You will see more than 7 shortcuts on the shortcuts bar.

Please check the attached screen shots of the issue.

Proposed resolution

Make sure the shortcut links limit validation works at server side.

Comments

caiovlp’s picture

StatusFileSize
new930 bytes

I tried to reproduce the issue, but I don't menu items being added to disabled list automatically. I created 18 shortcuts and all of them went active. As a matter of fact, I was not able to find a disabled list.

I went thought the shortcut module code and could not find any validation limiting the links number, but I found this:

/**
 * Adds a link to the end of a shortcut set<strong>, keeping within a prescribed limit</strong>.
 *
 * @param $link
 *   An array representing a shortcut link.
 * @param $shortcut_set
 *   An object representing the shortcut set which the link will be added to.
 *   The links in the shortcut set will be re-weighted so that the new link is
 *   at the end, <strong>and some existing links may be disabled (if the $limit
 *   parameter is provided)</strong>.
 */
function shortcut_admin_add_link($shortcut_link, &$shortcut_set) {

However, the function does not validate and $limit is never being passed in the call. So I made a patch to remove this documentation as I believe was not intended to be there.

caiovlp’s picture

Status: Active » Needs review
David_Rothstein’s picture

Version: 8.x-dev » 7.x-dev
Status: Needs review » Active

Drupal 8 no longer has a shortcut limit, so this issue is only valid for Drupal 7.

@caiovlp, can you move your patch to #1304486: Completely remove the ability to limit the number of shortcuts per set maybe? That's the issue that removed the $limit parameter (and the limit itself), but it looks like it did not update this documentation, and that issue is already reopened for other followup anyway.

caiovlp’s picture

Moved my patch to a new issue as we talked. Please refer to #1777392: $limit parameter removed from shortcut_admin_add_link, but still in documentation.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.