hooks.php

File structure

This file contains hooks the plugin is going to run.

$hooks = array(
	'action' => array( // action hooks
		'user/delete' => array( // run when 'user/delete' hook is executed
			'userDelete' => array( // function name in the hook file
				'path' => 'articles', // folder name in the "application/hooks" folder where hook file resides
				'object' => 'articles' // hook file name
			)
		),
		'view:user/view/sidebar' => array( // run when 'view:user/view/sidebar' hook is executed
			'userViewSidebararticles' => array( // function name in the hook file
				'path' => 'articles', // folder name in the "application/hooks" folder where hook file resides
				'object' => 'articles', // hook file name
				'order_id' => 5 // order ID that indicates when the hook should run, in case there is more than one hook file for a single action
			)
		)
	),
	'filter' => array( // filter hooks
		'timeline/notice/view/article_like' => array(
			'timelineNoticeViewarticleLike' => array(
				'path' => 'articles',
				'object' => 'articles'
			)
		)
	)
);

In the above example we set "path" to "articles" which means we should have "application/hooks/articles" folder. And "object" is set to "articles" which means we should have "articles.php" file inside that folder.

Hooks are saved into the "core_hooks" table in the database.