[-] PROJECT : Adding general hook on ObjectModel and AdminController
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12590 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -489,11 +489,13 @@ class AdminControllerCore extends Controller
|
|||||||
if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action))))
|
if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action))))
|
||||||
{
|
{
|
||||||
/* Hook Before Action */
|
/* Hook Before Action */
|
||||||
|
Hook::exec('actionAdminBefore', array('controller' => $this));
|
||||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
|
Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
|
||||||
|
|
||||||
$return = $this->{'process'.Tools::toCamelCase($this->action)}($token);
|
$return = $this->{'process'.Tools::toCamelCase($this->action)}($token);
|
||||||
|
|
||||||
/* Hook After Action */
|
/* Hook After Action */
|
||||||
|
Hook::exec('actionAdminAfter', array('controller' => $this, 'return' => $return));
|
||||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
@@ -501,11 +503,13 @@ class AdminControllerCore extends Controller
|
|||||||
else if (method_exists($this, $this->action))
|
else if (method_exists($this, $this->action))
|
||||||
{
|
{
|
||||||
/* Hook Before Action */
|
/* Hook Before Action */
|
||||||
|
Hook::exec('actionAdminBefore', array('controller' => $this));
|
||||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
|
Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
|
||||||
|
|
||||||
$return = call_user_func(array($this, $this->action), $this->boxes);
|
$return = call_user_func(array($this, $this->action), $this->boxes);
|
||||||
|
|
||||||
/* Hook After Action */
|
/* Hook After Action */
|
||||||
|
Hook::exec('actionAdminAfter', array('controller' => $this, 'return' => $return));
|
||||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
|
|||||||
@@ -372,6 +372,7 @@ abstract class ObjectModelCore
|
|||||||
public function add($autodate = true, $null_values = false)
|
public function add($autodate = true, $null_values = false)
|
||||||
{
|
{
|
||||||
// @hook actionObject*AddBefore
|
// @hook actionObject*AddBefore
|
||||||
|
Hook::exec('actionObjectAddBefore', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this));
|
||||||
|
|
||||||
// Automatically fill dates
|
// Automatically fill dates
|
||||||
@@ -430,6 +431,7 @@ abstract class ObjectModelCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @hook actionObject*AddAfter
|
// @hook actionObject*AddAfter
|
||||||
|
Hook::exec('actionObjectAddAfter', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'AddAfter', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'AddAfter', array('object' => $this));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -444,6 +446,7 @@ abstract class ObjectModelCore
|
|||||||
public function update($null_values = false)
|
public function update($null_values = false)
|
||||||
{
|
{
|
||||||
// @hook actionObject*UpdateBefore
|
// @hook actionObject*UpdateBefore
|
||||||
|
Hook::exec('actionObjectUpdateBefore', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'UpdateBefore', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'UpdateBefore', array('object' => $this));
|
||||||
|
|
||||||
$this->clearCache();
|
$this->clearCache();
|
||||||
@@ -504,6 +507,7 @@ abstract class ObjectModelCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @hook actionObject*UpdateAfter
|
// @hook actionObject*UpdateAfter
|
||||||
|
Hook::exec('actionObjectUpdateAfter', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'UpdateAfter', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'UpdateAfter', array('object' => $this));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -517,6 +521,7 @@ abstract class ObjectModelCore
|
|||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
// @hook actionObject*DeleteBefore
|
// @hook actionObject*DeleteBefore
|
||||||
|
Hook::exec('actionObjectDeleteBefore', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'DeleteBefore', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'DeleteBefore', array('object' => $this));
|
||||||
|
|
||||||
$this->clearCache();
|
$this->clearCache();
|
||||||
@@ -539,6 +544,7 @@ abstract class ObjectModelCore
|
|||||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.$this->def['table'].'_group_shop` WHERE `'.$this->def['primary'].'`='.(int)$this->id);
|
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.$this->def['table'].'_group_shop` WHERE `'.$this->def['primary'].'`='.(int)$this->id);
|
||||||
|
|
||||||
// @hook actionObject*DeleteAfter
|
// @hook actionObject*DeleteAfter
|
||||||
|
Hook::exec('actionObjectDeleteAfter', array('object' => $this));
|
||||||
Hook::exec('actionObject'.get_class($this).'DeleteAfter', array('object' => $this));
|
Hook::exec('actionObject'.get_class($this).'DeleteAfter', array('object' => $this));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
Reference in New Issue
Block a user