Change the order of tabs in the Content view
This is the current order
Media and Alert banners are used often but are too far over to the right
I think the order should be:
- Content
- Blocks (if user has permissions)
- Media
- Files (if user has permissions)
- Alert banners
- Directory facets
- Locations
- Page components
- Scheduling
- Service contacts
The reasoning for this is as follows:
- Content, blocks, media and files are used most so they're first
- The rest are used less so they're in alphabetical order
This needed a combination of changes in the following PRs:
- https://github.com/localgovdrupal/localgov_core/pull/226 (increases the weight of "Files" and "Page components" local task items).
- https://github.com/localgovdrupal/localgov_alert_banner/pull/330 (Alters the weight of "Alert banners" local task).
- https://github.com/localgovdrupal/localgov_directories/pull/379 (Alters the weight of "Directory facets" local task).
- https://github.com/localgovdrupal/localgov_geo/pull/120 (Alters the weight of "Locations" local task).
- https://github.com/localgovdrupal/localgov_workflows/pull/100 (Alters the weights of "Scheduling" and "Service contacts" local task items).
The resulting order of the Content page tabs after the above PRs make it into the main branch are:
- Content (weight -10, unchanged)
- Blocks (weight 0, unchanged)
- Media (weight 10, unchanged)
- Files (weight updated to 20)
- Alert banners (weight updated to 30)
- Directory facets (weight updated to 40)
- Locations (weight updated to 50)
- Page components (weight updated to 60)
- Scheduling (weight updated to 70)
- Service contacts (weight updated to 80)
Thanks @MariosORION !
Thanks for this @MariosORION ! Here's how I tested:
- Fresh install (on Gitpod @willguv :smile: )
- Enabling localgov_demo module.
- Composer required all the branches. (@willguv like this https://docs.localgovdrupal.org/devs/how-to/how-to-test-modules-with-gitpod.html#_5-testing-branches-from-github )
- Clear the cache. (
drush cr) - See the following order of the local tasks:
Crikey, quite a few pull requests to get through to re-arrange the tabs! I guess that makes sense.
Although, thinking about it now, could all this code be in one module? localgov_core for example? Oh no... I see now, lots of them are the default weight from config: https://github.com/localgovdrupal/localgov_directories/pull/379/files
Sorry! Totally makes sense!
Thanks @MariosORION and @willguv :smiley_cat:
This is brilliant, thanks Finn for testing and writing up these docs. I'll be able to take modules and branches for a spin, freeing up dev time. Will encourage others to get involved too.
Also thanks very much @MariosORION for picking this up at short notice.
Great work all round!
This is great, thanks both! Indeed @finnlewis , I wanted to keep the changes as "local" as possible hence the separate PRs. I was thinking about a testing workflow for this kind of change (e.g. referencing the actual branches in composer.json for local testing) - it looks like the Gitpod approach works really well - nice one! 👍👍
@MariosORION - quick question ( came up while reviewing and merging) - do the local tasks weights get exported as config, and so is it something that a specific site can override with config import?
@finnlewis short answer is yes. Long answer: Local tasks are made to primarily be static. Defaults are defined in example.links.task.yml files and hook_menu_local_tasks_alter can be used to alter these. The PRs here use a combination of the two, depending on the relative weight required for each item and how each item's weight is already defined (or altered) in the corresponding module. A specific site could override all of these using the same hook (also assuming that the weight of the module of the specific site where the hook implementation is added is greater than the weights of the modules utilising the same hook in these PRs).
Just installed this - looks great, thanks @MariosORION!
Great to hear, @willguv !