You are here

interface ImageStylesProviderInterface in Consumer Image Styles 4.x

Same name and namespace in other branches
  1. 8.2 src/ImageStylesProviderInterface.php \Drupal\consumer_image_styles\ImageStylesProviderInterface

Interface for consumer image style providers.

Hierarchy

Expanded class hierarchy of ImageStylesProviderInterface

All classes that implement ImageStylesProviderInterface

2 files declare their use of ImageStylesProviderInterface
ImageStyles.php in src/Plugin/jsonapi/FieldEnhancer/ImageStyles.php
LinkCollectionNormalizer.php in src/Normalizer/LinkCollectionNormalizer.php

File

src/ImageStylesProviderInterface.php, line 12

Namespace

Drupal\consumer_image_styles
View source
interface ImageStylesProviderInterface {

  /**
   * Load the image styles for a given consumer.
   *
   * @param \Drupal\consumers\Entity\Consumer $consumer
   *   Consumer entity to load image styles for.
   *
   * @return \Drupal\image\Entity\ImageStyle[]
   *   List of image styles keyed by image style id.
   */
  public function loadStyles(Consumer $consumer);

  /**
   * Builds a derivative link based on the image URI and the image style.
   *
   * @param string $uri
   *   The file URI.
   * @param \Drupal\image\ImageStyleInterface $image_style
   *   The image style to apply.
   *
   * @return array
   *   A structured array that complies with the JSON:API spec for links.
   *
   * @see https://jsonapi.org/format/#document-links
   */
  public function buildDerivativeLink($uri, ImageStyleInterface $image_style);

  /**
   * Checks if an entity is an image.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity.
   *
   * @return bool
   *   TRUE if the entity is an image.
   * {inheritdoc}
   */
  public function entityIsImage(EntityInterface $entity);

}

Members

Namesort descending Modifiers Type Description Overrides
ImageStylesProviderInterface::buildDerivativeLink public function Builds a derivative link based on the image URI and the image style. 1
ImageStylesProviderInterface::entityIsImage public function Checks if an entity is an image. 1
ImageStylesProviderInterface::loadStyles public function Load the image styles for a given consumer. 1