How to register a new helper with a plugin?

The extensions reference doesn’t mention adding new helper methods.

I noticed that I can simply define a function in my index.php file of the plugin:

function test () {
	echo 'testing';

…and I can use that function in my template:

<?= test() ?>

This works, but is it reliable? Is that an OK way to define a helper? It pollutes the global namespace, but with helpers - I think that’s kind of the point?

That’s perfectly fine and according to the docs:

1 Like