You are here

public function BlazyAdminBase::getResponsiveImageOptions in Blazy 8.2

Returns Responsive image for select options.

2 calls to BlazyAdminBase::getResponsiveImageOptions()
BlazyAdminBase::baseForm in src/Form/BlazyAdminBase.php
Returns simple form elements common for Views field, EB widget, formatters.
BlazyAdminFormatterBase::imageStyleForm in src/Form/BlazyAdminFormatterBase.php
Returns re-usable image formatter form elements.

File

src/Form/BlazyAdminBase.php, line 683

Class

BlazyAdminBase
A base for blazy admin integration 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] = Html::escape($image_style
            ->label());
        }
      }
    }
  }
  return $options;
}