You are here

protected function SerializedColumnNormalizerTrait::dataHasStringForSerializeColumn in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/serialization/src/Normalizer/SerializedColumnNormalizerTrait.php \Drupal\serialization\Normalizer\SerializedColumnNormalizerTrait::dataHasStringForSerializeColumn()

Checks if the data contains string value for serialize column.

Parameters

\Drupal\Core\Field\FieldItemInterface $field_item: The field item.

array $data: The data being denormalized.

Return value

bool TRUE if there is a string value for serialize column, otherwise FALSE.

1 call to SerializedColumnNormalizerTrait::dataHasStringForSerializeColumn()
SerializedColumnNormalizerTrait::checkForSerializedStrings in core/modules/serialization/src/Normalizer/SerializedColumnNormalizerTrait.php
Checks if there is a serialized string for a column.

File

core/modules/serialization/src/Normalizer/SerializedColumnNormalizerTrait.php, line 51

Class

SerializedColumnNormalizerTrait
A trait providing methods for serialized columns.

Namespace

Drupal\serialization\Normalizer

Code

protected function dataHasStringForSerializeColumn(FieldItemInterface $field_item, array $data) {
  foreach ($this
    ->getSerializedPropertyNames($field_item) as $property_name) {
    if (isset($data[$property_name]) && is_string($data[$property_name])) {
      return TRUE;
    }
  }
  return FALSE;
}