-
Notifications
You must be signed in to change notification settings - Fork 13
Add the possibility to define field layout tabs #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for organizing field layout sections into tabs, providing a cleaner UI for complex page forms. The translation key for "Status" has been moved from panel-specific (panel.pages.page.status) to general page translations (page.status) for better reusability.
- Introduced
TabandTabCollectionclasses to manage tab definitions in field layouts - Updated the sections view to render tabs and group sections by tab assignment
- Added JavaScript component for client-side tab switching behavior
- Enhanced CSS styling for tab UI components with focus states
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| site/schemes/pages/page.yaml | Added tabs configuration and assigned sections to tabs (content/options) |
| site/schemes/pages/blog.yaml | Updated blog section to reference parent tabs via tab: options |
| panel/views/pages/tree.php | Updated translation key from panel.pages.page.status to page.status |
| panel/views/pages/editor.php | Removed unnecessary wrapper div around fields insertion |
| panel/views/fields/layout/sections.php | Implemented tab rendering with grouped sections and tab panels |
| panel/views/fields.php | Added conditional logic to pass tabs collection to layout view |
| panel/translations/*.yaml | Removed panel.pages.page.status entries across all language files |
| formwork/translations/*.yaml | Added page.status entries across all language files |
| panel/src/ts/components/tabs.ts | New TypeScript component for tab switching functionality |
| panel/src/ts/app.ts | Integrated Tabs component into application initialization |
| panel/src/scss/components/_tabs.scss | Enhanced tab styles with borders, focus states, and panel visibility |
| formwork/src/Fields/Layout/TabCollection.php | New collection class for managing Tab instances |
| formwork/src/Fields/Layout/Tab.php | New class representing individual tabs with name, label, and order |
| formwork/src/Fields/Layout/SectionCollection.php | Updated to pass section name to Section constructor |
| formwork/src/Fields/Layout/Section.php | Added name property and getter, updated docstring |
| formwork/src/Fields/Layout/Layout.php | Added tabs support, deprecated type property, added tabs() getter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
544c435 to
22d53d9
Compare
22d53d9 to
486d1b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 40 out of 40 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces a new tab system for layouts in the Formwork CMS, including backend PHP classes for managing tabs, frontend SCSS and TypeScript for rendering and interaction, and updates to translation files to support the new "status" field in multiple languages. The changes are grouped into backend logic for tabs, frontend tab UI implementation, and translation updates.
Backend: Tab System Implementation
TabandTabCollectionclasses to manage tab data within layouts, similar to how sections are managed. (formwork/src/Fields/Layout/Tab.php[1]formwork/src/Fields/Layout/TabCollection.php[2]Layoutclass to support tabs: added atabsproperty, atabs()method for retrieving them, and adjusted the constructor and type property handling. (formwork/src/Fields/Layout/Layout.php[1] [2]SectionandSectionCollectionclasses to include section names as properties and constructor arguments, aligning them with the new tab structure. (formwork/src/Fields/Layout/Section.php[1] [2]formwork/src/Fields/Layout/SectionCollection.php[3]Frontend: Tab UI Implementation
panel/src/scss/components/_tabs.scsspanel/src/scss/components/_tabs.scssR18-R55)TabsTypeScript class to handle tab switching logic in the panel UI, and registered it in the main app initialization. (panel/src/ts/components/tabs.ts[1]panel/src/ts/app.ts[2] [3]Translations
formwork/translations/de.yaml[1]formwork/translations/en.yaml[2]formwork/translations/es.yaml[3]formwork/translations/fr.yaml[4]formwork/translations/it.yaml[5]formwork/translations/nl.yaml[6]formwork/translations/pl.yaml[7]formwork/translations/pt.yaml[8]formwork/translations/ro.yaml[9]formwork/translations/ru.yaml[10]formwork/translations/uk.yaml[11]These changes lay the groundwork for layouts with tabbed interfaces in both backend data structures and the frontend panel, and ensure that the new "status" field is properly localized.