mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/11043] Allow call_hook() to be called from more than one location.
Allow the helper function call_hook() of class phpbb_template to be called from more than once location and thus for more than one hook (although there is only one) by adding the method name as a parameter. PHPBB3-11043
This commit is contained in:
parent
10f8c738b6
commit
ae612de663
1 changed files with 6 additions and 5 deletions
|
@ -139,7 +139,7 @@ class phpbb_template
|
||||||
*/
|
*/
|
||||||
public function display($handle)
|
public function display($handle)
|
||||||
{
|
{
|
||||||
$result = $this->call_hook($handle);
|
$result = $this->call_hook($handle, __FUNCTION__);
|
||||||
if ($result !== false)
|
if ($result !== false)
|
||||||
{
|
{
|
||||||
return $result[0];
|
return $result[0];
|
||||||
|
@ -174,16 +174,17 @@ class phpbb_template
|
||||||
* Calls hook if any is defined.
|
* Calls hook if any is defined.
|
||||||
*
|
*
|
||||||
* @param string $handle Template handle being displayed.
|
* @param string $handle Template handle being displayed.
|
||||||
|
* @param string $method Method name of the caller.
|
||||||
*/
|
*/
|
||||||
private function call_hook($handle)
|
private function call_hook($handle, $method)
|
||||||
{
|
{
|
||||||
global $phpbb_hook;
|
global $phpbb_hook;
|
||||||
|
|
||||||
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $this))
|
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this))
|
||||||
{
|
{
|
||||||
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
|
if ($phpbb_hook->hook_return(array(__CLASS__, $method)))
|
||||||
{
|
{
|
||||||
$result = $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
|
$result = $phpbb_hook->hook_return_result(array(__CLASS__, $method));
|
||||||
return array($result);
|
return array($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue