This Nolt is piggybacking this archived Nolt:
https://kirby.nolt.io/369
Initially the wish was to be able to create an alias for go() to redirect(). The solution ended up being able to disable helper functions all together.
It is useful to be able to deactivate helper functions, but even better would be to be able to create an alias and still be able to use the function.
ie: instead of only being able to now say:
define('KIRBY_HELPER_GO', false);
being able to create an alias. Example:
define('KIRBY_HELPER_GO', 'redirect');
A lot of cookbook recipies uses go(), and its not intuitive how to solve the same need when go() is disabled.
Do you have an idea how we could implement that in PHP? Don’t think it’s possible to define functions with a dynamic name without trickery.
Sorry, but definitely beyond my PHP capabilities. Maybe I’m asking too much, but wanted to check if there were any options.
Maybe the problem is only really related to the “go()” function for now (at least from my googling around), and that an additional (duplicated) helper like redirect() could solve it?
Or even that both go() and redirect() are defined, and if go() is disabled, it has a fallback called redirect. Or even a safer fallback like kirbygo().
I don’t know. Just throwing out ideas.
Don’t think PHP supports this TBH, so I’m closing this. However you can solve it like this:
go()
helper with the constantindex.php
and name your version however you like.Thanks for taking the time looking at it, and I will try out that suggestion! :-)