function SerializedColumnNormalizerTrait::dataHasStringForSerializeColumn

Same name in other branches
  1. 8.9.x core/modules/serialization/src/Normalizer/SerializedColumnNormalizerTrait.php \Drupal\serialization\Normalizer\SerializedColumnNormalizerTrait::dataHasStringForSerializeColumn()
  2. 10 core/modules/serialization/src/Normalizer/SerializedColumnNormalizerTrait.php \Drupal\serialization\Normalizer\SerializedColumnNormalizerTrait::dataHasStringForSerializeColumn()
  3. 11.x 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.