I'm on D9.
I've a node edit form with a media field using the media library widget.
When a new media is added I'd need to run some custom code to replace one token, of the media path location, depending on the value of the node itself.
However, the route available with \Drupal::routeMatch()
is media_library.ui
and there is no node object available
I suppose this is correct, as the code is execute during the request "inside the media library widget".
Thus, i'm trying to find if is possibile somehow to get the "main\original" request from in that moment and the relative node object or if it is impossible. In the latter case, do you have idea if that objective is somehow possible?
\Drupal::routeMatch()
returns'media_library.ui'
, which isn't the route for a node edit form.token_tokens
because I'm trying to see if this patch is working drupal.org/project/token/issues/919760 with my use case. As I said, the route is not the one of the node edit form, because the code "runs" during the media insert, which is inside the "media widget modal"