getSlug(); $rawValue = $fields[$slug] ?? null; $customFieldType = $this->provider->getCustomFieldByType($customField->getType()); $deserializedValue = $customFieldType->deserialize($rawValue, $customField); return $customFieldType->isEmptyValue($deserializedValue, $customField); } /** * Render the value of a custom field. * * @param array $fields the **raw** array, as stored in the db * @param CustomField $customField the customField entity * @param string $documentType the type of document in which the rendered value is displayed ('html' or 'csv') * * @return The representation of the value the customField * * @throws CustomFieldsHelperException if slug is missing */ public function renderCustomField(array $fields, CustomField $customField, $documentType = 'html') { $slug = $customField->getSlug(); $rawValue = $fields[$slug] ?? null; $customFieldType = $this->provider->getCustomFieldByType($customField->getType()); return $customFieldType->render($rawValue, $customField, $documentType); } }