Showing the admin menu navigation as tree menu
radic - 1 month ago
So one of the biggest annoyances with PyroCMS 3 for us was the navigation. For example, wanting to manage user roles, you'd go trough:
- Click on Users
- [page reload]
- Click on Roles
- [page reload]
Sure.. that's no biggie. But it becomes quite annoying if you have stuff to do in multiple sections of multiple modules. Also the slide-in/slide out makes it that much more mouse-click's you have to do before getting somewhere. It was something for us that HAD to be improved.
So currently the navigation is build by
$this->dispatch(new BuildNavigation($this->builder)); $this->dispatch(new SetActiveNavigationLink($this->builder)); $this->dispatch(new SetMainNavigationLinks($this->builder)); $this->dispatch(new BuildSections($this->builder)); $this->dispatch(new SetActiveSection($this->builder));
Using that, i created the command BuildFullControlPanelNavigation
But running that actually almost doubled the application loading time! Not really knowing how to improve the command, i went ahead and implemented some sort of caching. This can be viewed in the ControlPanelServiceProvider
All in all, this was quite painful to achieve and this implementation is most likely far from ideal.
- What is the cause of the doubled application loading time? What can be done to improve the loading time?
- Is there a better way to build the admin menu completely? Currently the code needs to do some awkward things (module and link activation/deactivation to get the sections for example)
- I would like to remove the whole caching stuff. I merely have it as temporary workaround.