Skip to content

Commit

Permalink
Extend cpagefield image type
Browse files Browse the repository at this point in the history
  • Loading branch information
Veselin Totev committed Jan 17, 2020
1 parent 34047a2 commit c11b345
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion e107_handlers/e_customfields_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 : '<a class="cpage_image cpage_image_popup '.$parm['name'].'" href="'.$tp->replaceConstants($value, 'abs').'">'.$tp->toImage($value,$parm).'</a>';
}

return ($raw) ? $tp->thumbUrl($value,$parm) : $tp->toImage($value,$parm);
break;

Expand Down

0 comments on commit c11b345

Please sign in to comment.