Admin notice Hook used to display a notice in admin panel.
Step1: Register Call call back. See below format:
App::Module('Hook')
->setHookName('UI')
->setAction("register_notification")
->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 message like below
$messages[] = array(Message);
Name |
Type |
Description |
---|---|---|
Message |
Mandatory |
A string message to display in admin panel |
See below example:
class Component_Appstore_Register extends appRain_Base_Component
{
public function init(){
App::Module('Hook')->setHookName('UI')
->setAction("register_notification")
->Register(get_class($this),"register_admin_notification");
}
public function register_admin_notification()
{
$messages = Array();
$messages[] = array("New software update available");
return $srcpaths;
}
}