I have a particular base path recorded as a settings var, and I have a number of Views (v3) that unfortunately have this same value hard-coded as part of its links. These links are rendered using the Rewrite results
and Output this field as a link
options, and are built from a number of field values.
Problem is I have to configure this on every dev/test/prod site. It would be far better if these links could pull the information from the persistent variable.
A couple ideas:
I have tried defining this value as a bespoke token, but as I expected these View options do not support checking for and rendering Tokens. I was hoping that perhaps using the global fields of the
Views Field View
module might work. So that I might render a field asExclude from display
and reference it with normal Views replacement patterns. However this failed to render Tokens as well.I could step into each specific field in question and override with a particular template, wrapping its content in the link and sourcing the variable directly with
variable_get
. But this would actually be quite involved, and would also remove the primary reason for using Views in the first place — the possibility of live modification.
Is there a better way of using a persistent variable from within a View?
I already have a bespoke module set up, so have looked to see if it is possible to modify the replacement patterns of a view with a particular hook or something; however that hasn't turned anything up so far. My last remaining idea is to hook into the final render of the view and perform a token pass, but I don't know if this is such a good idea or not.
Rewrite results
do not seem to apply Tokens by default, and have no text filter options.PHP Filter
(which I can't and wouldn't do), however with this you define far safer callbacks in your code. Interesting. I'll definitely keep this in mind although perhaps for another future attempt.