Skip to content

Commit fb5fa27

Browse files
committed
Show redirect source in admin breadcrumbs
Sylius's shared crud breadcrumb template falls back to resource.id when no rendered_field is configured, so the redirect breadcrumb read 'Dashboard / Redirects / 1 / Edit'. Hook into the sylius_admin.redirect.{update,show}.content.header twig hooks via prepend() and set rendered_field: source so the breadcrumb shows the source URL instead. Also note in CLAUDE.md that 'symfony server:status' is per-project and must be run from tests/Application — running it at the repo root reports 'Not Running' even when the test app server is up.
1 parent f6807bf commit fb5fa27

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ symfony server:start # https://127.0.
9898
- If you've changed directory (e.g. into `tests/Application/`) for a previous step, return to the project root before subsequent commands so relative paths still resolve correctly. Don't try to compensate by prepending an absolute path — `cd` back to the root instead.
9999
- Run the test-app console from the project root via `./tests/Application/bin/console <cmd>` instead of `cd tests/Application && php bin/console <cmd>`. It avoids the `cd` round-trip and keeps the working directory at the project root for any follow-up commands.
100100
- Before running `symfony server:start`, run `symfony server:status` first — the test app server may already be up from a previous step. Starting a second instance fails noisily; reusing the existing one (its URL is in the status output) skips a multi-second boot. `symfony server:start --dir=...` interprets the dir relative to its own internals and rejects relative paths like `tests/Application` (looks for `tests/Application/tests`); pass `$(pwd)/tests/Application` if you really need to start a fresh server.
101+
- `symfony server:status` is **per-project**: it inspects the cwd to figure out which app to ask about. Running it from the repo root reports "Not Running" even when the test app is up, because there's no Symfony app at the root. Always run `cd tests/Application && symfony server:status` (or invoke it inside that directory) before deciding whether to start a new server.
101102
- When you build or change a feature with a UI surface (admin form, grid, page), verify it via the Playwright MCP — boot the test app (see "Booting the test app locally"), navigate to the affected page, and confirm the rendered output before reporting the task as complete. Don't rely on PHPUnit/PHPStan/ECS alone for UI work.
102103
- Twig extensions should split into an `Extension` (eagerly loaded, declares functions/filters) and a `Runtime` (lazily instantiated, holds dependencies and runs the logic). Wire functions via `[Runtime::class, 'method']` and tag the runtime service with `twig.runtime`. This keeps the extension cheap to load and the dependencies (e.g. repositories) only constructed when a template actually calls one.
103104
- When adding or updating translation keys, update every locale file in `translations/` (e.g. `messages.en.yaml`, `messages.da.yaml`, ...), not just English. Missing translations leak the raw key into the UI for non-English admins.

src/DependencyInjection/SetonoSyliusRedirectExtension.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,30 @@ public function prepend(ContainerBuilder $container): void
143143
'hooks' => [
144144
'sylius_admin.redirect.create.content.form.sections' => $formSections,
145145
'sylius_admin.redirect.update.content.form.sections' => $formSections,
146+
'sylius_admin.redirect.update.content.header' => [
147+
'breadcrumbs' => [
148+
'template' => '@SyliusAdmin/shared/crud/update/content/header/breadcrumbs.html.twig',
149+
'configuration' => [
150+
'rendered_field' => 'source',
151+
],
152+
'priority' => 0,
153+
],
154+
],
146155
'sylius_admin.redirect.show.content' => [
147156
'sections' => [
148157
'template' => '@SetonoSyliusRedirectPlugin/admin/redirect/show/content/sections.html.twig',
149158
'priority' => 0,
150159
],
151160
],
161+
'sylius_admin.redirect.show.content.header' => [
162+
'breadcrumbs' => [
163+
'template' => '@SyliusAdmin/shared/crud/show/content/header/breadcrumbs.html.twig',
164+
'configuration' => [
165+
'rendered_field' => 'source',
166+
],
167+
'priority' => 0,
168+
],
169+
],
152170
'sylius_admin.redirect.show.content.sections' => [
153171
'general' => [
154172
'template' => '@SetonoSyliusRedirectPlugin/admin/redirect/show/content/sections/general.html.twig',

0 commit comments

Comments
 (0)