mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
check for hook attached to parent class in hasHook()
This commit is contained in:
parent
ae4a65e8bc
commit
31697278d1
|
@ -181,11 +181,20 @@ class SeedDMS_View_Common {
|
|||
* null if no hook was called
|
||||
*/
|
||||
public function hasHook($hook) { /* {{{ */
|
||||
$tmps = array();
|
||||
$tmp = explode('_', get_class($this));
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])] as $hookObj) {
|
||||
if (method_exists($hookObj, $hook)) {
|
||||
return true;
|
||||
$tmps[] = $tmp[2];
|
||||
$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)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user