Skip to content

Add the possibility to define field layout tabs - #789

Merged
giuscris merged 5 commits into
2.xfrom
feature/layouts-tabs
Nov 22, 2025
Merged

Add the possibility to define field layout tabs#789
giuscris merged 5 commits into
2.xfrom
feature/layouts-tabs

Conversation

@giuscris

@giuscris giuscris commented Nov 16, 2025

Copy link
Copy Markdown
Member

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

  • Added new Tab and TabCollection classes 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]
  • Updated the Layout class to support tabs: added a tabs property, a tabs() method for retrieving them, and adjusted the constructor and type property handling. (formwork/src/Fields/Layout/Layout.php [1] [2]
  • Modified the Section and SectionCollection classes 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

  • Added new SCSS styles for tabs and panels, including focus, active, and visibility states. (panel/src/scss/components/_tabs.scss panel/src/scss/components/_tabs.scssR18-R55)
  • Implemented a new Tabs TypeScript 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

  • Added the "page.status" translation key and related status labels to all supported languages, enabling translated status display in the UI. (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.

@giuscris giuscris added this to the 2.2.0 milestone Nov 16, 2025
@giuscris
giuscris requested a review from Copilot November 16, 2025 18:32
@giuscris giuscris self-assigned this Nov 16, 2025
@giuscris giuscris added the enhancement New feature or request label Nov 16, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 Tab and TabCollection classes 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.

Comment thread formwork/src/Fields/Layout/Tab.php Outdated
Comment thread panel/src/ts/components/tabs.ts
Comment thread panel/src/scss/components/_tabs.scss Outdated
Comment thread panel/views/fields/layout/sections.php Outdated
Comment thread formwork/src/Fields/Layout/Layout.php
Comment thread panel/views/fields/layout/sections.php Outdated
Comment thread panel/views/fields/layout/sections.php Outdated
Comment thread panel/src/ts/components/tabs.ts Outdated
Comment thread panel/views/fields/layout/sections.php Outdated
@giuscris
giuscris force-pushed the feature/layouts-tabs branch 2 times, most recently from 544c435 to 22d53d9 Compare November 18, 2025 22:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread panel/views/fields/layout/sections.php Outdated
Comment thread panel/src/ts/components/tabs.ts
Comment thread formwork/src/Fields/Layout/Tab.php Outdated
Comment thread formwork/src/Fields/Layout/Section.php Outdated
Comment thread panel/views/fields.php
Comment thread panel/views/fields/layout/sections.php
@giuscris
giuscris marked this pull request as ready for review November 22, 2025 12:52
@giuscris
giuscris merged commit 9452268 into 2.x Nov 22, 2025
2 checks passed
@giuscris
giuscris deleted the feature/layouts-tabs branch November 22, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants