Is there a way to change the output programatically on a specific field in d8 views?
I have a field called 'IMCID' which I want to output as a link, but the link is going to change based on the value of another field for that row.
For example, if IMCID of row #1 is 15, and Format of row #1 is 'Copy', then I want the output URL to be something like example.com/copy/15
, however if IMCID of row #1 is 15, and Format is 'Hard Copy', then the output URL would be example.com/hardcopy/15
If possible, I would like to avoid making multiple template files for individual fields, as this functionality will be carried over onto other fields later on, and would rather not have to manage a ton of template files.
I have tried using hook_pre_render()
and hook_post_render()
, but the markup doesn't appear to be in this hook so I am not sure how to update the link URL.