-
Notifications
You must be signed in to change notification settings - Fork 25
Plugin Hooks
nirix edited this page Jul 30, 2012
·
1 revision
Hook names are based on what makes sense for where the hook is, which generally is {type}:{class::method}{path/to/section}
.
For example, say we're hooking into the view
action of the TicketsController
, the name would be controller:tickets::view
, the same goes for models, except controller
would be model
.
If we were to hook into the nav
of the default
layout, the hook would be template:layouts/default/nav
.
And if we were hooking into a regular class, the name would be class_name::method
.
So a complete example of hooking into a successful save of the usercp
action of the UsersController
class UsersController extends AppController
{
public function action_usercp()
{
if (Request::$method == 'post')
{
$this->user->set(...);
if ($this->user->save())
{
FishHook::run('controller:users::usercp/saved');
Request::redirect(...);
}
}
}
}