Using modifiers: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
{{howto|Advanced|[[Boy Baukema]] <boy@achievo.org>}} | {{howto|Advanced|[[Boy Baukema]] <boy@achievo.org>}} | ||
Modifiers allow you to modify nodes on before they are used. Making it possible to do such things | |||
as to add or remove attributes to a node before it is loaded. | |||
Example of using modifiers: | |||
Add in your module_preload.inc: | |||
$modifiers[] = 'modules.node'; | |||
In your module_inc: | |||
function module_node_modifier(&$node) | |||
{ | |||
useattrib('atkDummyAttribute'); | |||
$node->add(new atkDummyAttribute('mydummyattrib','Dummy attribute added by modifier'), 'default',9999999); | |||
} | |||
Revision as of 13:21, 13 July 2006
|
ATK Howto: Using modifiers
|
Modifiers allow you to modify nodes on before they are used. Making it possible to do such things as to add or remove attributes to a node before it is loaded.
Example of using modifiers:
Add in your module_preload.inc:
$modifiers[] = 'modules.node';
In your module_inc:
function module_node_modifier(&$node)
{
useattrib('atkDummyAttribute');
$node->add(new atkDummyAttribute('mydummyattrib','Dummy attribute added by modifier'), 'default',9999999);
}