mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 13:06:14 +00:00
check for hook attached to parent class in hasHook()
This commit is contained in:
parent
ae4a65e8bc
commit
31697278d1
|
@ -181,14 +181,23 @@ class SeedDMS_View_Common {
|
||||||
* null if no hook was called
|
* null if no hook was called
|
||||||
*/
|
*/
|
||||||
public function hasHook($hook) { /* {{{ */
|
public function hasHook($hook) { /* {{{ */
|
||||||
|
$tmps = array();
|
||||||
$tmp = explode('_', get_class($this));
|
$tmp = explode('_', get_class($this));
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])])) {
|
$tmps[] = $tmp[2];
|
||||||
foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])] as $hookObj) {
|
$tmp = explode('_', get_parent_class($this));
|
||||||
|
$tmps[] = $tmp[2];
|
||||||
|
/* Run array_unique() in case the parent class has the same suffix */
|
||||||
|
$tmps = array_unique($tmps);
|
||||||
|
$ret = null;
|
||||||
|
foreach($tmps as $tmp) {
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp)])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp)] as $hookObj) {
|
||||||
if (method_exists($hookObj, $hook)) {
|
if (method_exists($hookObj, $hook)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user