From: Roland Haeder Date: Sat, 18 Apr 2015 01:39:54 +0000 (+0200) Subject: Allowed to set extra instance (for special cases, okay). X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=c20fc3e6a992d5fa6c511a40c04a7c801e09adf7 Allowed to set extra instance (for special cases, okay). Signed-off-by: Roland Häder --- 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;