Jump to content

Hooks; the docs are misleading


numediaweb

Recommended Posts

The 1.6 docs says: 

In order to attach your code to a hook, you must create a non-static public method, starting with the "hook" keyword followed by either "display" or "action", and the name of the hook you want to use.

 

So why we have this hook:

$this->registerHook('displayFooterProduct')..

but then we the called back method named differently in our module:

public function hookProductFooter($params).. 

Isn't that supposed to follow the naming convention and be 

public function hookDisplayFooterProduct($params).. 

And why 'display' in the docs is lowercase and in the method is first letter uppercase 'Display'.

 

 

To finish, as I wanted to call a custom hook from a template, the doc says:

It is easy to call a hook from within a template file (.tpl): you simply have to use its name with the hook function. You can add the name of a module that you want the hook execute.

What do they mean by You can add the name of a module that you want the hook execute.?

 

Thanks!

Edited by numediaweb (see edit history)
Link to comment
Share on other sites

What do they mean by You can add the name of a module that you want the hook execute.?

 

It is actually be the class name of the module in lower case - which is also the directory name of the module (via the naming convention).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...