This Hook used to create website menu.
Step1: Register Call call back. See below format:
App::Module('Hook')
->setHookName("Sitemenu")
->setAction("register_sitemenu")
->Register(Call Back Class Name, Call Back Function Name);
Name |
Type |
Description |
---|---|---|
Call Back Class Name |
Mandatory |
Class Name of call back function |
Call Back Function Name |
Mandatory |
Call back function |
Step 2: Register resource in Call back function:
In call back function we return an array with menu information like below
$menu[] = Array(Link,Text,Name);
Name |
Type |
Description |
---|---|---|
Link |
Mandatory |
Menu URL |
Text |
Mandatory |
Menu text |
Menu Name |
Mandatory |
A menu unique name |
See below example:
class Component_Appstore_Register extends appRain_Base_Component
{
public function init()
{
App::Module('Hook')
->setHookName('Sitemenu')
->setAction("register_sitemenu")
->Register(get_class($this),"register_sitemenu");
}
public function register_sitemenu($send)
{
$menu = Array();
$menu[] = Array(
App::Helper('Config')->baseurl("/store"),
App::COnfig()->Setting('appstoresettings_title','Store'),
'store'
);
return $menu;
}
}