Jump to content

Using custom action handlers

From NusaATK
Revision as of 07:15, 16 July 2010 by ReneB (talk | contribs) (Created page with '{{Howto|Easy|Rene Bakx <rene@nospamformeplease.71media.net>}} ==Using the atkActionHandler to extend a handler== Note upfront, this is only tested on ATK 6.5. Every action…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ATK Howto: Using custom action handlers

Complexity: Easy
Author: Rene Bakx <rene@nospamformeplease.71media.net>

List of other Howto's

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.