Content Hook

Navigation:  Components > Hook >

Content Hook

Previous pageReturn to chapter overviewNext page

User to add content in UI Hooks.
 
Step1: Register Call call back. See below format:
 
App::Module('Hook')

   ->setHookName("UI")

   ->setAction("home_content_area_A")

   ->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 HTML content:

 

 

See below example:
 
class Component_Appstore_Register extends appRain_Base_Component
{
    public function init(){
        App::Module('Hook')
            ->setHookName('UI')
            ->setAction("template_header_B")
            ->Register(get_class($this),"add_cart_link");
                           
        App::Module('Hook')
            ->setHookName('UI')
            ->setAction("home_content_area_A")
            ->Register(get_class($this),"add_html");
 
    }
 
    public function add_cart_link($send)
    {
 
        $html  = '<a href="#">Test Link</a>';
        
        return $html;
    }
    
    public function add_html($send)
    {
        $products = array("id"=>5);
        
        return App::Helper('Utility')
            ->callElementByPath(
                $this->attachMyPath('elements/updates.phtml'),
                array('products'=>$products)
        );
        
    }   
}