You are here

public function BlazyAdminFormatterBase::getResponsiveImageOptions in Blazy 8

Same name and namespace in other branches
  1. 7 src/Form/BlazyAdminFormatterBase.php \Drupal\blazy\Form\BlazyAdminFormatterBase::getResponsiveImageOptions()

Returns Responsive image for select options.

1 call to BlazyAdminFormatterBase::getResponsiveImageOptions()
BlazyAdminFormatterBase::imageStyleForm in src/Form/BlazyAdminFormatterBase.php
Returns re-usable image formatter form elements.

File

src/Form/BlazyAdminFormatterBase.php, line 255

Class

BlazyAdminFormatterBase
A base for field formatter admin to have re-usable methods in one place.

Namespace

Drupal\blazy\Form

Code

public function getResponsiveImageOptions() {
  $options = [];
  if ($this
    ->blazyManager()
    ->getModuleHandler()
    ->moduleExists('responsive_image')) {
    $image_styles = $this
      ->blazyManager()
      ->entityLoadMultiple('responsive_image_style');
    if (!empty($image_styles)) {
      foreach ($image_styles as $name => $image_style) {
        if ($image_style
          ->hasImageStyleMappings()) {
          $options[$name] = strip_tags($image_style
            ->label());
        }
      }
    }
  }
  return $options;
}