From 3c096b3466c2ef2540dac4a471fce2d51cd5a19c Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 23 Oct 2017 09:52:39 +0200 Subject: [PATCH] An example from Sebastian Bergmann of how we can inject dependancies --- infolog/inc/class.infolog_ui.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 64ea6b4ed9..d30af64248 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -95,7 +95,7 @@ class infolog_ui * * @return infolog_ui */ - function __construct() + function __construct(Etemplate $etemplate = null) { if ($GLOBALS['egw_info']['flags']['currentapp'] != 'infolog') Api\Translation::add_app('infolog'); @@ -107,7 +107,11 @@ class infolog_ui $this->bo = new infolog_bo(); - $this->tmpl = new Etemplate(); + if($etemplate === null) + { + $etemplate = new Etemplate(); + } + $this->tmpl = $etemplate; $this->user = $GLOBALS['egw_info']['user']['account_id'];