Addon

Navigation:  Components > Hook >

Addon

Previous pageReturn to chapter overviewNext page

This Hook help to register a new Addons in system.  We have to register it in two step.

 

Step1: Register Call call back. See below format:
 
App::Module('Hook')

   ->setHookName('Addon')

   ->setAction("register_addon")

   ->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 a list of addon name and definition xml path. See below format:

 

$srcpaths[] =   array(

   'type'=>Addon Name,

   'path'=>Addon Path

);
 
 

Name

Type

Description

Addon Name

Mandatory

Addon Name that used to load from Action Method

Call Back Function Name

Mandatory

File path of the addon definition.

 

See below example:
 
class Component_Appstore_Register extends appRain_Base_Component
{

   public function init()
   {
       App::Module('Hook')
           ->setHookName('Addon')
           ->setAction("register_addon")
           ->Register(get_class($this),"register_addon_defination");
   }

 
   public function register_addon_defination()
   {
       $srcpaths = Array();
       $srcpaths[] =   array(
          'type'=>'appstore',
          'path'=>$this->attachMyPath('addons/appstore.xml')
       );
 
      return $srcpaths;
   }
}