From c11b345a66e315c5f7e80865c2ae38c8940bd326 Mon Sep 17 00:00:00 2001 From: Veselin Totev Date: Fri, 17 Jan 2020 11:33:48 +0200 Subject: [PATCH] Extend cpagefield image type --- e107_handlers/e_customfields_class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/e107_handlers/e_customfields_class.php b/e107_handlers/e_customfields_class.php index a2c2774b0b..19bbc9c851 100644 --- a/e107_handlers/e_customfields_class.php +++ b/e107_handlers/e_customfields_class.php @@ -138,7 +138,7 @@ public function getFieldValue($key, $parm=array()) $fieldType = $this->_config[$key]['type']; - if($value === null) + if($value === null || empty($value)) { return null; } @@ -164,6 +164,15 @@ public function getFieldValue($key, $parm=array()) case "image": + //{CPAGEFIELD: name=XXXX&type=full} return full path to image. This ignore thumb params. + if($type == 'full') { + return ($raw) ? $value : $tp->replaceConstants($value, 'abs'); + } + //{CPAGEFIELD: name=XXXX&type=popup} return a wrapped image with link to full image path. + if($type == 'popup') { + return ($raw) ? $value : ''.$tp->toImage($value,$parm).''; + } + return ($raw) ? $tp->thumbUrl($value,$parm) : $tp->toImage($value,$parm); break;