You are here

public function JuiceboxFormatter::confBaseStylePresets in Juicebox HTML5 Responsive Image Galleries 8.2

Same name and namespace in other branches
  1. 8.3 src/JuiceboxFormatter.php \Drupal\juicebox\JuiceboxFormatter::confBaseStylePresets()

Get the image style preset options.

Options that should be available in configuration style picklists.

This is in may ways just a wrapper for image_style_options() that allows the addition of specical options that only Juicebox understands (e.g. "multi-size").

Parameters

bool $allow_multisize: Whether-or-not to allow the addition of a PRO "multi-size" option. This is only included if this option is TRUE and the currently detected library is compatible with multi-size features.

Return value

array An associative array of style presets.

Overrides JuiceboxFormatterInterface::confBaseStylePresets

File

src/JuiceboxFormatter.php, line 597

Class

JuiceboxFormatter
Class to define a Drupal service with common formatter methods.

Namespace

Drupal\juicebox

Code

public function confBaseStylePresets($allow_multisize = TRUE) {
  $library = $this
    ->getLibrary();

  // Get available image style presets.
  $presets = image_style_options(FALSE);

  // If multisize is allowed, include it with the normal styles.
  if ($allow_multisize && !in_array('juicebox_multisize_image_style', $library['disallowed_conf'])) {
    $presets = [
      'juicebox_multisize' => t('Juicebox PRO multi-size (adaptive)'),
    ] + $presets;
  }
  return $presets;
}