Add the possibility to define navigation item children#862
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the panel navigation to support defining “tab” navigation as child navigation items in configuration, and renders both tabs and sidebar navigation via reusable partials instead of controller-provided tab arrays.
Changes:
- Define options/tools tabs as
childreninpanel/config/navigation.phpand render them via a newpartials/navigation/tabs.phppartial. - Refactor sidebar rendering to use a new
partials/navigation/sidebar.phppartial. - Extend panel navigation model/collection to support nested children and array (de)serialization.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| panel/views/tools/updates.php | Switches from controller-provided $tabs HTML to the new navigation tabs partial. |
| panel/views/tools/tabs.php | Removes legacy tools tabs view. |
| panel/views/tools/info.php | Switches to the new navigation tabs partial. |
| panel/views/tools/backups.php | Switches to the new navigation tabs partial. |
| panel/views/partials/sidebar.php | Replaces inline sidebar rendering loop with an inserted partial. |
| panel/views/partials/navigation/tabs.php | Adds reusable tabs renderer driven by navigation children. |
| panel/views/partials/navigation/sidebar.php | Adds reusable sidebar renderer driven by navigation items. |
| panel/views/options/tabs.php | Removes legacy options tabs view. |
| panel/views/options/system.php | Switches to the new navigation tabs partial. |
| panel/views/options/site.php | Switches to the new navigation tabs partial. |
| panel/src/scss/components/_tabs.scss | Adds spacing styling for tab icons. |
| panel/config/navigation.php | Introduces children for options/tools and removes redundant badge => null entries. |
| formwork/src/Panel/Panel.php | Updates navigation loading to build via NavigationItemCollection::fromArray(). |
| formwork/src/Panel/Navigation/NavigationItemCollection.php | Adds ArraySerializable support and fromArray()/toArray() helpers. |
| formwork/src/Panel/Navigation/NavigationItem.php | Adds children() support plus fromArray()/toArray() handling for nested items. |
| formwork/src/Panel/Controllers/ToolsController.php | Removes hardcoded tabs array and stops passing rendered tabs to views. |
| formwork/src/Panel/Controllers/OptionsController.php | Removes hardcoded tabs array and stops passing rendered tabs to views. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how navigation tabs are handled in the panel, making the navigation structure more flexible and maintainable. Instead of hardcoding tab arrays and rendering logic in controllers and views, tabs are now defined as navigation children in the configuration and rendered using reusable partials. This change also introduces improved handling for navigation items and collections, including support for nested items.
Navigation Structure Refactoring
childrenin the navigation config (panel/config/navigation.php), replacing hardcoded arrays in controllers. This enables dynamic tab generation and easier future extension. [1] [2] [3] [4]OptionsController,ToolsController) no longer maintain their own tab arrays or pass tab views; views now use navigation children for tab rendering. [1] [2] [3] [4] [5]Navigation Item & Collection Improvements
NavigationItemandNavigationItemCollectionclasses now implementArraySerializableand support nested children, with new methods for serialization and construction from arrays. [1] [2] [3]NavigationItemCollection::fromArrayfor building navigation items, supporting nested structures.View and Partial Updates
options/tabs.php,tools/tabs.php) are removed and replaced with a new partial (partials/navigation/tabs.php) that renders navigation tabs based on navigation children. [1] [2] [3]options/site.php,options/system.php,tools/backups.php,tools/info.php,tools/updates.php) now use the new tab partial, passing appropriate navigation children. [1] [2] [3] [4] [5]Styling