You are here

protected function ImageStyles::imageStylesForField in Consumer Image Styles 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/jsonapi/FieldEnhancer/ImageStyles.php \Drupal\consumer_image_styles\Plugin\jsonapi\FieldEnhancer\ImageStyles::imageStylesForField()

Gets the list of image style IDs for the current field.

Intersects the field enhancer configuration with the consumer's config to calculate the list of image styles to apply to the field.

Return value

string[] The list of IDs.

1 call to ImageStyles::imageStylesForField()
ImageStyles::doUndoTransform in src/Plugin/jsonapi/FieldEnhancer/ImageStyles.php

File

src/Plugin/jsonapi/FieldEnhancer/ImageStyles.php, line 131

Class

ImageStyles
Perform additional manipulations to timestamp fields.

Namespace

Drupal\consumer_image_styles\Plugin\jsonapi\FieldEnhancer

Code

protected function imageStylesForField() {
  $configuration = $this
    ->getConfiguration();
  $image_style_ids = $configuration['consumer_image_style_ids'];

  // By default make all the image styles for the consumer available, but
  // allow further refinement.
  if (!empty($configuration['styles']['refine']) && !empty($configuration['styles']['custom_selection'])) {
    $refined_style_ids = $configuration['styles']['custom_selection'];
    $image_style_ids = array_intersect($refined_style_ids, $image_style_ids);
  }
  return $image_style_ids;
}