You are here

protected function LinkCollectionNormalizer::getConsumer in Consumer Image Styles 4.x

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

Gets the current consumer.

Return value

\Drupal\consumers\Entity\Consumer The current consumer or NULL if one cannot be negotiated.

1 call to LinkCollectionNormalizer::getConsumer()
LinkCollectionNormalizer::normalize in src/Normalizer/LinkCollectionNormalizer.php

File

src/Normalizer/LinkCollectionNormalizer.php, line 163

Class

LinkCollectionNormalizer
Custom normalizer that add the derivatives to image entities.

Namespace

Drupal\consumer_image_styles\Normalizer

Code

protected function getConsumer() {
  try {
    return $this->consumerNegotiator
      ->negotiateFromRequest($this->requestStack
      ->getCurrentRequest());
  } catch (MissingConsumer $e) {
    return NULL;
  }
}