Using custom action handlers
|
ATK Howto: Using custom action handlers
|
Using the atkActionHandler to extend a handler
Note upfront, this is only tested on ATK 6.5.
Every action, like export, add, delete etc, within a node can be extended to use your own action, or in the case of this snippet to change the behaviour of the export action. The customer wanted to export every field of the node, regardless things that where on AF_HIDE_LIST without the need to toggle the buttons on every export.
Adding a handler to your node
atkimport("mymodule.myExporthandler");
atkRegisterNodeHandler('myNode', 'export', new myExporthandler());
Where the mymodule is ofcourse your module folder, the myExporthandler the name of your handler etc. The aktRegisterNodeHandler also takes a * as first parameter to match all the nodes in the scope, if you hook the node handler in your own extended atkNode for example.
The myExportHandler class is an extended atkActionHandler where some of the functions where overloaded, but the third parameter can also be a static method with two parameters (see atknode.Callhandler method)
For a overview of default available and thus extendable actionHandler the handlers folder in your atk root.