protected function SerializedColumnNormalizerTrait::getCustomSerializedPropertyNames in Drupal 10
Same name and namespace in other branches
- 8 core/modules/serialization/src/Normalizer/SerializedColumnNormalizerTrait.php \Drupal\serialization\Normalizer\SerializedColumnNormalizerTrait::getCustomSerializedPropertyNames()
- 9 core/modules/serialization/src/Normalizer/SerializedColumnNormalizerTrait.php \Drupal\serialization\Normalizer\SerializedColumnNormalizerTrait::getCustomSerializedPropertyNames()
Gets the names of all properties the plugin treats as serialized data.
This allows the field storage definition or entity type to provide a setting for serialized properties. This can be used for fields that handle serialized data themselves and do not rely on the serialized schema flag.
Parameters
\Drupal\Core\Field\FieldItemInterface $field_item: The field item.
Return value
string[] The property names for serialized properties.
1 call to SerializedColumnNormalizerTrait::getCustomSerializedPropertyNames()
- SerializedColumnNormalizerTrait::getSerializedPropertyNames in core/
modules/ serialization/ src/ Normalizer/ SerializedColumnNormalizerTrait.php - Gets the names of all serialized properties.
File
- core/
modules/ serialization/ src/ Normalizer/ SerializedColumnNormalizerTrait.php, line 101
Class
- SerializedColumnNormalizerTrait
- A trait providing methods for serialized columns.
Namespace
Drupal\serialization\NormalizerCode
protected function getCustomSerializedPropertyNames(FieldItemInterface $field_item) {
if ($field_item instanceof PluginInspectionInterface) {
$definition = $field_item
->getPluginDefinition();
$serialized_fields = $field_item
->getEntity()
->getEntityType()
->get('serialized_field_property_names');
$field_name = $field_item
->getFieldDefinition()
->getName();
if (is_array($serialized_fields) && isset($serialized_fields[$field_name]) && is_array($serialized_fields[$field_name])) {
return $serialized_fields[$field_name];
}
if (isset($definition['serialized_property_names']) && is_array($definition['serialized_property_names'])) {
return $definition['serialized_property_names'];
}
}
return [];
}