Add a field formatter to render user-visible order links (instead of admin-only canonical route)

Created on 10 April 2025, 12 days ago

Describe your bug or feature request.

I have a custom entity that includes an entity_reference that points to the order associated with that entity. Out of the box, if I configure this entity_reference field to show up as a Label, and click the 'Link to entity' checkbox, I end up with links pointing to /admin/commerce/orders/N which is the canonical route for the order entity. However, only store admins can access that route. End users get /user/X/order/Y links they can use. But there's no clean way to configure my custom entity to use those links when configuring this order reference field.

Per https://drupal.slack.com/archives/C1TLCCF9B/p1743475820458189 when I asked about this, and proposed a FieldFormatter plugin as the solution, @rszrama said:

But no harm in a separate formatter specific to linking to the order owner view page.

So here we are. 😅

Feature request
Status

Active

Version

3.0

Component

Order

Created by

🇺🇸United States dww

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024