Commit 13aa462
committed
bug #7568 Use formattedValue consistently in UrlField on index and detail pages (lacatoire)
This PR was merged into the 4.x branch.
Discussion
----------
Use formattedValue consistently in UrlField on index and detail pages
The `UrlField` template uses `field.formattedValue` as the anchor text on the index page but `field.value` on the detail page. This asymmetry prevents `->formatValue()` callbacks from affecting the detail rendering, even though `CommonPostConfigurator` already computes the formatted value for both pages.
## Behavior change
`UrlConfigurator::configure()` sets `formattedValue` to a "pretty" URL for every `UrlField` (strips `http://`, `https://`, `www.`, and the trailing `/`; additionally truncates to 32 chars on index only). This PR aligns the detail page rendering with the index rendering, minus the truncation. For `https://www.example.com/path/` the anchor text on detail changes from `https://www.example.com/path/` to `example.com/path`.
The `href` attribute keeps using `field.value` (the raw URL), so the link target is unchanged.
The `isUnsafe` branch is kept as-is: it intentionally renders the raw value as muted text to signal that a dangerous URL was blocked.
Closes #6864
Commits
-------
b79ea35 Use formattedValue consistently in UrlField on index and detail pages2 files changed
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
0 commit comments