Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
search.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Aug 2012 at 23:22 UTC
Updated:
29 Jul 2014 at 21:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
coredumperror commentedAfter looking further into this, I discovered that the answer to my original question is "No", because of how
search_menu()is currently written. It adds a hard-coded weight of 0 to every search tab, thus the order cannot be changed.So, I made a quick patch to implement a way for module authors to set their tab's weight alongside the title and path they provide in their implementation of
hook_search_info(). I included an update to the docstring forhook_search_info(), though I'm sure it's formatted poorly due to my ignorance of the rules. The "minimum -99 and maximum 99" thing is becausesearch_menu()now subtracts 200 from the default module's weight (rather than 10 like it did before), so the weight limits are there to insure that the subtraction actually puts the default module first on the non-%menu_tail'd search pages.The real solution to this issue is probably to alter the "Active Search Modules" fieldset on
admin/config/search/settingsto add weight settings, but that's way too complicated (and time consuming) for me to do.Comment #2
heddnAn easy way to adjust the search tab order is with hook_menu_alter(). The example below moves example last in the list.
Comment #3
coredumperror commentedThank you! This worked quite wonderfully.
I think that my suggestion of adding weights to the Active Search Module fieldset on
admin/config/search/settingswould be an even better solution, though, so I'm going to leave this issue open. Obviously, that kind of change won't be made to Drupal 7, though, so I've changed the version to 8.x-dev.Comment #4
jhodgdontitle update
Comment #5
tim.plunkett#2042807: Convert search plugins to use a ConfigEntity and a PluginBag now converts to using tabledrag to control the order. Once that is actually in, this can just be moved back to D7.
Comment #6
jhodgdonI do not think we will fix it for 7. Feature request. So we can probably close this as "won't fix" if we take care of 8.x on the other issue.
Comment #7
coredumperror commentedYeah, heddn's workaround is good enough for D7, I think. I've been using it on my company's site for a while.
Comment #8
jhodgdonThat other issue is definitely allowing you to set the order of search tabs, so marking this as a duplicate (since we do not do feature requests in 7 and this is therefore an 8-only issue).