Confused how to make a twig function

I want to

Output some PHP code result in a Twig template

I made a new plugin with those three files but I get the following error
Declaration of Grav\Plugin\ExampleTwigExtension::getFunctions() must be compatible with Grav\Common\Twig\Extension\GravExtension::getFunctions(): array

I have seen this
load the Twig extension from your theme/plugin

Does that mean I should put the plugin into user/themes/quark ?

Try changing

public function getFunctions()

To

public function getFunctions(): array

Your getFunctions() declaration must match the extended getFunctions()

That’s basically what the error says. Docs probably are a bit outdated

1 Like