crptag

crpTag compliant modules and Hooks

This is an example list of module which are proved to work with crpTag:

  • crpCalendar
  • crpVideo
  • locations
  • News
  • Pages
  • Reviews
  • htmlpages
  • Ephemerids
  • FAQ
  • Feeds

Many other modules could be in this list: the only condition is that hooks are implemented correctly. So, don't complain crpTag if it doesn't work with a module and check module's hooks calls.

Hooks required

Hooks used by crpTag are of two types: API and GUI. To be short: API hooks are the ones used after an SQL statement execution while GUI hooks are used into templates. So, the source module makes database operation or displays something: after every action it can call hooks for the maked operation.

API hooks

Item creation

This hook should be called by the source module after a creation (SQL INSERT) of an element:

// Let any other modules know we have created an item
pnModCallHooks('item', 'create', $object['eventid'], array ('module' => 'crpCalendar'));

$objecteventid? is the module's specific key variable ($pid, $sid, etc) of the newly created item, and 'module' well...should be module's name

Item update

This hook should be called by the source module after an update (SQL UPDATE) of an element:

// Let any other modules know we have created an item
pnModCallHooks('item', 'update', $inputValues['eventid'], array ('module' => 'crpCalendar'));

$inputValueseventid? is the module's specific key variable ($pid, $sid, etc) of the updated item

Item delete

This hook should be called by the source module after a deletion (SQL DELETE) of an element:

// Let any other modules know we have created an item
pnModCallHooks('item', 'delete', $eventid, array ('module' => 'crpCalendar'));

$eventid is the module's specific key variable ($pid, $sid, etc) of the updated item

Module remove

This hook is not called by the source module but by the modules_adminapi_remove() func:

// call any module delete hooks
pnModCallHooks('module', 'remove', $modinfo['name'], array('module' => $modinfo['name']));

crpTag has the module remove hook registered so when a module which was hooked with crpTag is uninstalled, every tag from that module are removed from the database

GUI hooks

Item display

This kind of hooks for recent Zikula modules are present into templates:

<!--[pnmodcallhooks hookobject=item hookaction=display hookid=$videoid module=crpVideo returnurl=$returnurl]-->

'hookid' and 'module' are very mandatory. So, what's happen ? In this case the module crpVideo calls every module registered as a hook requesting to do something because he maked a 'display' of an 'item' with an 'hookid'. crpTag for example have a 'GUI'+'item'+'display' registered so it will respond with the 'user'+'embedtag' function, as from pninit():

// display hooked tags
pnModRegisterHook('item', 'display', 'GUI', 'crpTag', 'user', 'embedtag')

Item new

<!--[pnmodcallhooks hookobject=item hookaction=new module=crpVideo]-->

Look at the previous explanation, pretty the same thing...

// embed on new form
pnModRegisterHook('item', 'new', 'GUI', 'crpTag', 'user', 'newtag')

Item modify

<!--[pnmodcallhooks hookobject=item hookaction=modify hookid=$videoid module=crpVideo]-->

Look at the previous explanation, pretty the same thing...

// embed on edit form
pnModRegisterHook('item', 'modify', 'GUI', 'crpTag', 'user', 'modifytag')

That's all for now ...

 
 
Powered by Trac
Design by Arcsin