Closed (fixed)
Project:
Commerce Core
Version:
3.x-dev
Component:
Order
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
25 Nov 2025 at 15:29 UTC
Updated:
3 Jun 2026 at 23:00 UTC
Jump to comment: Most recent
We do not want users clicking through these contextual links to the direct profile forms. The profiles should only be editable here in the context of the relevant modals.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jsacksick commented@tbkot: I'm actually concerned this might not play well with caching... As the rendered entity should be cached in cache_render bin right? And adding a "cache" route context might essentially make the cache useless right? Also I'm afraid we're messing with other entity types right?
Comment #4
rszrama commentedSeems to do the trick for me. Will let jsacksick decide if this is the best approach vs. a more targeted alteration.
Comment #5
jsacksick commentedI went with a hook_preprocess_HOOK() instead for profiles. It seems to be invoked every time, but I think it should potentially suffer from the same theoretical issue no? (i.e not invoked if the rendered entity is in cache)?
What's interesting is the Layout builder module does the following:
I thought my logic was invoked all the time due to this, but even after uninstalling the Layout Builder module the preprocess hook is still invoked... I'm wondering what is the best course of action... Add a "route" cache context from a
hook_ENTITY_TYPE_build_defaults_alter()and keep the alteration where it is or move it to ahook_ENTITY_TYPE_view_alter()Also the logic removes the contextual links on any route having an order parameter. This for example covers the modal route when opened outside of the modal.
Comment #6
jsacksick commentedI did this instead, to be on the safe side...
If Layout Builder does something similar for ALL entity types, I guess we can "safely" do the same.
Comment #7
rszrama commentedWorked for me on local!
Comment #9
jsacksick commentedComment #12
davidwhthomas commentedFWIW, I have a site that isn't using the modal approach and needed to preserve the contextual links for profiles on orders.
This alter hook provides an override option to keep contextual links on order routes.
Just adding in case anyone else is looking to preserve contextual profile links on orders.