Jump to content

Using modifiers: Difference between revisions

From NusaATK
No edit summary
No edit summary
Line 12: Line 12:
In your module_inc:
In your module_inc:


  function module_node_modifier(&$node)
  class mod_mymodule extends atkModule
  {
  {
     useattrib('atkDummyAttribute');
     function module_node_modifier(&$node)
    $node->add(new atkDummyAttribute('mydummyattrib','Dummy attribute added by modifier'), 'default',9999999);
    {
      useattrib('atkDummyAttribute');
      $node->add(new atkDummyAttribute('mydummyattrib','Dummy attribute added by modifier'), 'default',9999999);
    }
  }
  }

Revision as of 13:25, 13 July 2006

ATK Howto: Using modifiers

Complexity: Advanced
Author: Boy Baukema <boy@achievo.org>

List of other Howto's

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:

class mod_mymodule extends atkModule 
{
   function module_node_modifier(&$node)
   {
     useattrib('atkDummyAttribute');
     $node->add(new atkDummyAttribute('mydummyattrib','Dummy attribute added by modifier'), 'default',9999999);
   }
}