I have created a (private) plugin, ginacpmods
. The main class is called GinaCp
which extends Plugin
.
The plugin has an admin page which is rendered with templates/index.twig
. This twig file contains a button which, will execute craft.ginacpmods.clearAll()
. This doesn't work. All I get back is
Calling unknown method: craft\web\twig\variables\CraftVariable::ginacpmods()
I've tried referencing ginacp
, ginacpmods
, _ginacpmods
but neither works. I'm starting to wonder what I'm missing.
The function I'm calling is dead simple right now and doesn't really do anything yet:
plugins/ginacpmods/src/GinaCp.php:
class GinaCp extends Plugin {
[...]
public function clearAll(): bool|array|string {
return 'Done.';
}
Is there something I need to do in order to expose the clearAll() function to twig?