diff --git a/plugins/fields/subfields/subfields.php b/plugins/fields/subfields/subfields.php index b3d75b8583f61..eca04e53d3c3d 100644 --- a/plugins/fields/subfields/subfields.php +++ b/plugins/fields/subfields/subfields.php @@ -185,15 +185,8 @@ public function onCustomFieldsPrepareField($context, $item, $field) // For each row, iterate over all the subfields foreach ($this->getSubfieldsFromField($field) as $subfield) { - // Just to be sure, unset this subfields value (and rawvalue) - $subfield->rawvalue = $subfield->value = ''; - - // If we have data for this field in the current row - if (isset($row[$subfield->name]) && $row[$subfield->name]) - { - // Take over the data into our virtual subfield - $subfield->rawvalue = $subfield->value = $row[$subfield->name]; - } + // Fill value (and rawvalue) if we have data for this subfield in the current row, otherwise set them to empty + $subfield->rawvalue = $subfield->value = isset($row[$subfield->name]) ? $row[$subfield->name] : ''; // Do we want to render the value of this field, and is the value non-empty? if ($subfield->value !== '' && $subfield->render_values == '1')