Skip to content

Instantly share code, notes, and snippets.

@devudit
Created August 1, 2016 10:10
Show Gist options
  • Select an option

  • Save devudit/0f4434d6b0051ef0e2d984c5031ead23 to your computer and use it in GitHub Desktop.

Select an option

Save devudit/0f4434d6b0051ef0e2d984c5031ead23 to your computer and use it in GitHub Desktop.
Multiple Hooks in one extension - Expression Engine
<?php
$hooks = array(
"template_fetch_template" => "template_fetch_template",
"store_order_item_add_start" => "store_order_item_add_start"
);
foreach ($hooks as $hook => $method){
$data = array(
'class' => __CLASS__,
'method' => $hook,
'hook' => $method,
'priority' => 10,
'settings' => '',
'version' => $this->version,
'enabled' => 'y'
);
ee()->db->insert('extensions', $data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment