Search the Community
Showing results for tags 'hookable'.
-
Hi there. I wrote a custom module for one of my projects. In fact I maybe want to use my module in other projects too. In order to be variable and customizable I need to implement some custom hooks into my module. So I can afterwards hook into the my functions in order to modify them to match the needs of the new project. I tried simply defining functions with the '__' prefix. But that did not work. I'm imagining something like the following: <?php class MyClass { public function ___someFunction() { // Do something } } // ready.php $this->addHookBefore('MyClass::someFunction', function($event) { // some customization }); Is there a way to accomplish that?
-
Hi all, Not sure if this is even possible but I would like to add a button on my modules configuration page that triggers a method to run. The method in question belongs to the module itself. Is this possible? So far I have: MyModule.module public function init(){ wire('forms')->addHookAfter('InputfieldSubmit:processInput', $this, 'foo'); } public function foo(){ error_log('IT WORKS!!'); return; } MyModuleConfig.php public function __construct() { $this->add( [ [ 'name' => 'Foo Button', 'type' => 'InputfieldSubmit', 'value' => 'Fire Foo Method', ] ] ); } This renders the button but so far haven't had any luck getting the method to fire successfully. I haven't found any examples from my investigations so apologies if this is an impossible request.
- 4 replies
-
- module
- configuration
-
(and 1 more)
Tagged with: