You are here

protected function PhotoswipeResponsiveFieldFormatter::getImageStyles in PhotoSwipe 3.x

Get default image styles.

Return value

array Image styles.

Overrides PhotoswipeFieldFormatter::getImageStyles

File

src/Plugin/Field/FieldFormatter/PhotoswipeResponsiveFieldFormatter.php, line 61

Class

PhotoswipeResponsiveFieldFormatter
Provides formatter that supports responsive image.

Namespace

Drupal\photoswipe\Plugin\Field\FieldFormatter

Code

protected function getImageStyles() {
  $resp_image_store = $this->entityManager
    ->getStorage('responsive_image_style');
  $responsive_image_options = [];
  $responsive_image_styles = $resp_image_store
    ->loadMultiple();
  foreach ($responsive_image_styles as $machine_name => $responsive_image_style) {
    if ($responsive_image_style
      ->hasImageStyleMappings()) {
      $responsive_image_options[$machine_name] = $responsive_image_style
        ->label();
    }
  }
  return $responsive_image_options;
}