You are here

public function PathFieldItemListNormalizer::normalize in Replication 8

Overrides ListNormalizer::normalize

File

src/Normalizer/PathFieldItemListNormalizer.php, line 28

Class

PathFieldItemListNormalizer
Normalizes path field.

Namespace

Drupal\replication\Normalizer

Code

public function normalize($field_item, $format = NULL, array $context = []) {
  $value = $field_item
    ->getValue();
  $entity = $field_item
    ->getEntity();
  if (isset($entity->path->pathauto)) {
    $value[0]['pathauto'] = $entity->path->pathauto;
  }
  return $value;
}