From c20fc3e6a992d5fa6c511a40c04a7c801e09adf7 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sat, 18 Apr 2015 03:39:54 +0200 Subject: [PATCH] Allowed to set extra instance (for special cases, okay). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- inc/classes/main/helper/class_BaseHelper.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/inc/classes/main/helper/class_BaseHelper.php b/inc/classes/main/helper/class_BaseHelper.php index 8011081a..45b74bb3 100644 --- a/inc/classes/main/helper/class_BaseHelper.php +++ b/inc/classes/main/helper/class_BaseHelper.php @@ -149,6 +149,16 @@ class BaseHelper extends BaseFrameworkSystem { return $this->content; } + /** + * Public setter for extra instance + * + * @param $extraInstance An extra instance of FrameworkInterface to set + * @return void + */ + public final function setExtraInstance (FrameworkInterface $extraInstance) { + $this->extraInstance = $extraInstance; + } + /** * Assigns a field from the value instance with a template variable * @@ -453,13 +463,14 @@ class BaseHelper extends BaseFrameworkSystem { // Get the field value $fieldValue = $this->getValueInstance()->getField($fieldName); - //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).')'); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - BEFORE!'); // Is it null? if ((is_null($fieldValue)) && (!is_null($this->extraInstance))) { // So try the extra instance $fieldValue = $this->extraInstance->getField($fieldName); } // END - if + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput($fieldName.'[]='.gettype($fieldValue).'('.strlen($fieldValue).') - AFTER!'); // Return it return $fieldValue; -- 2.39.5