Skip to content

Find a layout by its reference - #615

Merged
silverbackdan merged 2 commits into
mainfrom
feature/layout-by-reference
Nov 25, 2026
Merged

silverbackdan merged 2 commits into
mainfrom
feature/layout-by-reference

Conversation

@silverbackdan

Copy link
Copy Markdown
Collaborator

`GET /_/layouts/` finds a Layout by its `reference` as well as by its UUID, as ComponentGroup already does. The module (cwa-nuxt alpha.40) fetches a layout by reference for non-CWA pages that name one via `definePageMeta`.

  • `LayoutStateProvider` (resource-level `provider:`, copying `ComponentGroupStateProvider`) and `LayoutRepository::findOneByIdOrReference()`: the reference first, then the UUID. `@id` stays the UUID IRI.
  • `Layout` joins `UuidUriVariableTransformer`'s built-in list, so a non-UUID id reaches the provider instead of being a 404.
  • Item writes inherit the provider, as ComponentGroup's do, so a PATCH by reference works (pinned).
  • A UUID-shaped id arrives already transformed to a `Uuid`; the provider casts it back to a string so a layout whose reference equals another layout's UUID still wins (ComponentGroup's provider passes a `Uuid` straight to the ItemProvider, so it does not do this).

Tests: `tests/Functional/Layout/LayoutByReferenceTest.php` (by reference with UUID `@id`, reference wins over a UUID, unknown is 404, cache tag + PATCH purge, PATCH by reference, anonymous read), plus unit tests for the provider, repository and transformer. Functional Layout/ComponentGroup/Identifier tests pass in both controller and listener mode.

🤖 Generated with Claude Code

@silverbackdan

Copy link
Copy Markdown
Collaborator Author

Docs issue: components-web-app/docs#343

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.24%. Comparing base (d4b6370) to head (ca4f1a9).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #615      +/-   ##
============================================
+ Coverage     97.22%   97.24%   +0.01%     
- Complexity     5579     5587       +8     
============================================
  Files           459      460       +1     
  Lines         14316    14335      +19     
============================================
+ Hits          13919    13940      +21     
+ Misses          397      395       -2     
Flag Coverage Δ
phpunit 97.24% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@silverbackdan
silverbackdan merged commit 22f3fab into main Nov 25, 2026
14 of 15 checks passed
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