8000 feat: sections shown as tabs by Klehm · Pull Request #103 · Klehm/content-blocks-project · GitHub
[go: up one dir, main page]

Skip to content

feat: sections shown as tabs - #103

Merged
Klehm merged 4 commits into
masterfrom
feat/section-tabs
Dec 3, 2026
Merged

Klehm merged 4 commits into
masterfrom
feat/section-tabs

Conversation

@Klehm
@Klehm Klehm commented Dec 3, 2026
Copy link
Copy Markdown
Owner

Summary

Sections can be shown as tabs: when a tab needs its own columns, background or spacing, each tab is a whole section. Consecutive sections flagged tab form one group.

The branch also carries the groundwork it builds on (first commit): section anchors, tabs and panels opened from the URL, the slider peek and a section gutter.

Core (klehm/content-blocks)

  • Making tabs: Show as a tab in the new Tab panel, or Turn into tabs on the section toolbar (POST /section/{id}/tabs, adds a second tab, one undo step). Start a new tab group splits a run. At most 20 tabs per group.
  • In the builder: the tab bar selects a section, + Tab adds one, a title or style edit relabels the bar in place (no preview reload).
  • Tab styles: underline (default), pills, cards. Hosts add, restyle or hide one through content_blocks.section.tab_styles or TabStyleProviderInterface. A TabStyle names the fields its tab shows and may bring its own template. Host fields join the Tab panel through a form type extension and SectionSettingsType::tabStyleCondition().
  • On a phone the group is an accordion. A tab that shows its own columns as tabs or an accordion stacks them under .cb-col-title headings instead (the sidebar offers only Grid and Slider on mobile there).
  • Everywhere else:
    • #anchor opens a tab, and #anchor-N its N-th column.
    • A copied tab (duplicate, paste, template) joins the group it lands in.
    • The navigator, the library thumbnail and the headless tree (tab, tabGroup) show tabs.
  • New seams: SectionSettingsResolverInterface and SectionCloneObserverInterface, the section twins of the column ones.
  • No core migration: everything is stored in the section settings.

i18n (klehm/content-blocks-i18n)

  • A tab's title and subtitle are translated, in a new table cb_section_translation (migration Version20261203120000 in the sandbox).
  • They follow every flow a block translation takes: render with per-field fallback, Publish/Discard (per locale too), duplicate, template and clipboard, export/import, the workbench (entries section-{id}) and machine translation.

Docs

  • New guide docs/guide/section-tabs.md, added to the site menu.
  • Rationale in docs/internals/rendering.md#section-tabs and docs/internals/i18n.md#section-tabs-are-translated-beside-the-section.
  • The backward-compatibility page covers the new surface.
  • Upgrade note for the i18n migration.

Test plan

  • PHPUnit: core 1541, kit 422, i18n 281
  • Vitest: core 605, i18n 42, SEO 37
  • Playwright: main suite 269/269, including section-tabs.spec.js, the immutability net and the workbench translating a section tab; Encore suite 11/11
  • Both published-render immutability nets cover making tabs and adding a tab
  • PHPStan level 8, php-cs-fixer, internal docs links, VitePress build
  • BC check (roave): no backward-incompatible change in the three packages

Klehm added 4 commits December 3, 2026 14:21
Consecutive sections flagged `tab` render as one group of tabs, each a
whole section; an accordion on a phone. Grouping is read at render time
from each mode's settings, never written on a move, delete or insert.

- Builder: "Turn into tabs" on the section toolbar (one undo step),
  "+ Tab" in the group's nav, a click on a tab selects its section, the
  sidebar's Tab panel (title, subtitle, icon, style, new group).
- Tab styles: underline, pills and cards built in; hosts add their own
  through `content_blocks.section.tab_styles` or a
  `TabStyleProviderInterface`, with their own fields and tab template.
- Nesting: a tab may show its columns as tabs or an accordion on desktop
  and tablet; on a phone it stacks them under their titles.
- The navigator names a tab by its title.
- Covered by both published-render immutability nets and a dedicated
  Playwright spec.
- Headless: each section carries `tab` and `tabGroup` (its group's first
  section id, by the HTML render's rule); the tree stays flat.
- `#anchor-N` inside a section tab now opens the section tab and then the
  column panel; it stopped after the section tab.
- A duplicated, pasted or template-inserted tab joins the group it lands
  next to: the copy drops `tabNewGroup`, which split the group when its
  first tab was duplicated. Import and Insert content keep it.
The title and subtitle of a section shown as a tab live in a new table,
cb_section_translation, beside the column titles, and follow every flow a
block translation does: render with per-field fallback, Publish/Discard,
duplicate, template and clipboard, export/import, the workbench and the
machine run. Core gains SectionSettingsResolverInterface and
SectionCloneObserverInterface for it.
A saved tab shows its tab on the library thumbnail, the tab icon is hidden
from assistive technology (the SEO audit no longer reports it), the guide
joins the docs site, and the backward-compatibility page covers the tab
styles, the new seams, the tab template's variables and the new table.
@Klehm
Klehm merged commit 187ebd1 into master Dec 3, 2026
53 checks passed
@Klehm
Klehm deleted the feat/section-tabs branch December 3, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0