How to apply extension hook in expressionengine

162 Views Asked by At

I'm working on expressionengine v2 and i have followed the docs at their site to make extension hooks, i've created a file in third party folder and install that from cp(control panel). Now i don't know how to call that function using hook just to show some text.

$hooks = array(
    'after_channel_entry_insert' => 'after_channel_entry_insert',
    'before_channel_entry_update' => 'before_channel_entry_update'
);

foreach ($hooks as $hook_name => $method_name) {

    $data[] = array(
        'class'     => __CLASS__,
        'method'    => $method_name,
        'hook'      => $hook_name,
        'settings'  => serialize($this->settings),
        'priority'  => 10,
        'version'   => $this->version,
        'enabled'   => 'y'
     );
}
//insert data in extension table
ee()->db->insert_batch('extensions', $data);

//now i want to call this function on hook
function after_channel_entry_insert($data = '') {
    die('after_channel_entry_insert');
}
0

There are 0 best solutions below