You are here

public function LinkCollectionNormalizer::normalize in Consumer Image Styles 8.3

Same name and namespace in other branches
  1. 4.x src/Normalizer/LinkCollectionNormalizer.php \Drupal\consumer_image_styles\Normalizer\LinkCollectionNormalizer::normalize()

File

src/Normalizer/LinkCollectionNormalizer.php, line 84

Class

LinkCollectionNormalizer
Custom normalizer that add the derivatives to image entities.

Namespace

Drupal\consumer_image_styles\Normalizer

Code

public function normalize($link_collection, $format = NULL, array $context = []) {
  assert($link_collection instanceof LinkCollection);
  if ($this
    ->decorationApplies($link_collection) && ($consumer = $this
    ->getConsumer())) {
    $variant_links = $this
      ->buildVariantLinks($link_collection
      ->getContext(), $consumer);
    $normalization = $this->inner
      ->normalize(LinkCollection::merge($link_collection, $variant_links), $format, $context);
    return static::addLinkRels($normalization, $variant_links);
  }
  return $this->inner
    ->normalize($link_collection, $format, $context);
}