diff --git a/e107_handlers/e_customfields_class.php b/e107_handlers/e_customfields_class.php index 3dac5a14c..0dbe17534 100644 --- a/e107_handlers/e_customfields_class.php +++ b/e107_handlers/e_customfields_class.php @@ -150,6 +150,8 @@ return null; } + $ret = null; + switch($fieldType) { case 'dropdown': @@ -160,11 +162,7 @@ case 'video': - if(empty($value)) - { - $ret = null; - } - else + if(!empty($value)) { $ret = ($raw) ? 'https://www.youtube.com/watch?v='.str_replace('.youtube', '', $value) : $tp->toVideo($value); } @@ -173,7 +171,10 @@ case 'image': - $ret = ($raw) ? $tp->thumbUrl($value,$parm) : $tp->toImage($value,$parm); + if(!empty($value)) + { + $ret = ($raw) ? $tp->thumbUrl($value,$parm) : $tp->toImage($value,$parm); + } break; case 'icon': @@ -198,11 +199,7 @@ break; case 'file': - if(empty($value)) - { - $ret = null; - } - else + if(!empty($value)) { $ret = ($raw) ? $tp->toFile($value, array('raw'=>1)) : $tp->toFile($value); } diff --git a/e107_tests/tests/unit/e_customfieldsTest.php b/e107_tests/tests/unit/e_customfieldsTest.php index 4a117b485..0a08fb5b2 100644 --- a/e107_tests/tests/unit/e_customfieldsTest.php +++ b/e107_tests/tests/unit/e_customfieldsTest.php @@ -258,7 +258,7 @@ $expectedRawValues = array ( 'image' => 'thumb.php?src=', 'video' => 'https://www.youtube.com/watch?v=WcuRPzB4RNc', - 'bbarea' => '
Rich text.
', + 'bbarea' => '[html]Rich text.
[/html]', 'boolean' => '1', 'checkboxes' => 'boat,plane', 'country' => 'ad',