Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
shortcut.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Jun 2011 at 14:36 UTC
Updated:
29 Jul 2014 at 19:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Tor Arne Thune commentedSubscribing, because I agree, and would like to see this happen.
Comment #2
David_Rothstein commentedWithout shortcut_install(), the module won't work (because there would be no default shortcut set). It would take some refactoring to change that.
On the other hand, it would be easy enough to remove the specific links that are installed and put them in the install profile instead... but then what would you get if you turn the module on later? An empty shortcut bar? We should have a reasonable user experience for people turning on the module post-installation also.
Comment #3
tstoecklerTurning on the module post-installation means they are using minimal profile and, hence, will probably be offended by the preconfigured shortcuts anyway (note that we don't even ship with any node types in minimal) or are using a custom profile, which can take care of that on its own (i.e. regardless of actually enabling shortcut module, it can provide defaults).
Comment #4
tstoecklerMaybe to give more context to the problem this causes and why I'm tending to mark this as bug:
This makes writing install profiles just that much more painful, because while shortcut module is a really cool tool and really useful to customize for install profiles, you have to unset the default links.
Comment #5
David_Rothstein commentedIt should be very simple for an install profile to replace the default shortcut links with ones of its own. Something like the code below (and it would be the same code regardless of whether or not the shortcut module provides its own default links or leaves them empty).
It's possible that it's not the same code currently, but if so, that's a bug to be fixed - I think due to #609122: shortcut_set_save() no longer deletes existing links when a new set of links is passed in ?
Comment #6
tstoecklerHere's a patch.
Comment #8
catchThis issue would likely have fixed #1187906: Shortcut module cannot be installed via an install profile if the menu module wasn't installed first. If having a default shortcut set is required, an empty one could be created, or we'd need to account for no default set.
Comment #9
sunThe shortcut set saved in shortcut_install() is not necessarily the shortcut_default_set().
I'm not sure what the expected behavior of that default installation set is, but I do wonder why it's not setting
It looks like that is or was the intention, but I'm not sure.
Trailing white-space.
11 days to next Drupal core point release.
Comment #11
sunI'd highly prefer this patch over #1376150: Shortcut module installation fails in tests when installed later (due to menu system not saving menu links correctly) (which kinda opened a rabbit hole on its own)
Comment #12
sunThe essential question to ask here is:
Does Shortcut module require at minimum one shortcut set to work (without errors)?
- "No" means that the "default" shortcut set should be configured by an installation profile.
- "Yes" means that
shortcut_install()has to create an empty set.Let's see.
Though frankly, if the answer is "Yes", then Shortcut module's design ought to be fixed, IMHO.
Comment #14
sunAlright, Shortcut requires a default set to exist, so this stuff needs to be split appropriately.
Comment #16
Tor Arne Thune commentedWhat happens if you install with a profile that does not create the default shortcut set and enable the shortcut module after installation?
Comment #17
sunWith the latest patch, Shortcut module always creates an initial (empty) default shortcut set, which is required for it to operate. Thus, there is always a default shortcut set.
The only part that is moved into the install profile is the creation of links in the default shortcut set, because those links heavily depend on which other modules are installed. E.g., Standard profile can add links to content admin pages there, because it installs Node module. Other profiles may not install Node module.
I think that just simply makes sense. :) The remaining task here would be to fix the shortcut test failures - it looks like one of the test cases assumes the default links to be there.
Comment #18
Tor Arne Thune commentedOh yes, the solution makes sense. The empty shortcut set on shortcut.module install will avoid the problem nicely.
Comment #19
Tor Arne Thune commentedI'll have a look at the failing tests. Looks like testShortcutQuickLink() assumes that the default shortcut set is populated, but since we no longer use the standard install profile for tests, it's not.
Comment #20
Tor Arne Thune commentedThis could be one solution.
Comment #22
Tor Arne Thune commented#20: drupal8.shortcut-install.20.patch queued for re-testing.
Comment #23
Tor Arne Thune commentedDid some manual testing while I was at it, as my D8 dev site was hosed (for other reasons). Installing with the standard profile works as expected, as well as installing with the minimal profile and enabling the shortcut module. I can add, edit and delete shortcuts from the default shortcut set.
Comment #24
sunAwesome, thanks! :)
Comment #25
webchickDavid's concerns are valid, but just so you know, without the patch, this is the default behaviour when you enable this module from minimal profile, without this patch:
I'm sure someone had some kind of good reason for making the Shortcut module not have Toolbar as a dependency, but it's already a total WTF situation. So I'm not sure we should be as concerned about this particular aspect. OTOH, it's worth looking into.
When you then enable Toolbar without this patch, you get what looks like the standard default links:
With this patch, you get this:
I actually think that's sufficient for getting people on their way. While the shortcut bar is empty, the link to edit the shortcuts is plainly visible, ripe for the clicking.
This patch actually does a good job of removing some extremely weird code that needs 30 lines of comments to explain in favour of reasonable lines of code that make a lot sense. I think this is worth doing, but #701974: Add hook for example content might be a good general issue to work on to solve this across modules which might not be as easy to "start from scratch" for an end user (Forum comes to mind).
Therefore, committed and pushed to 8.x. We'll need a change notice since profiles depending on this behaviour will need to be adjusted accordingly.
Comment #26
David_Rothstein commented#1262966: Make the Shortcut module depend on the Toolbar module (closed - won't fix) :)
As long as issues like that exist, I don't actually have any real objections here. (Though I don't know if that will get implemented any time soon...)
Comment #27
sunWe discussed this in IRC, and it doesn't seem to make sense to create a change notice for this, since install profiles will have to be completely rewritten for D8 either way.