You are here

public function JuiceboxFormatter::runCommonBuild in Juicebox HTML5 Responsive Image Galleries 8.3

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

Common post-build task.

Task that should take place whenever gallery of any type/source is built.

Parameters

Drupal\juicebox\JuiceboxGalleryInterface $gallery: An initialized Juicebox gallery object.

array $settings: An associative array of common gallery-specific settings.

mixed $data: Drupal source data that was used to build the gallery. This is included purely for reference.

Overrides JuiceboxFormatterInterface::runCommonBuild

File

src/JuiceboxFormatter.php, line 221

Class

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

Namespace

Drupal\juicebox

Code

public function runCommonBuild(JuiceboxGalleryInterface $gallery, array $settings, $data = NULL) {
  $global_settings = $this
    ->getGlobalSettings();

  // Add all gallery options directly from the settings.
  $this
    ->setGalleryOptions($gallery, $settings);

  // Also attempt to translate interface strings.
  if ($global_settings['translate_interface']) {
    $base_string = $global_settings['base_languagelist'];
    if (!empty($base_string)) {
      $base_string = Html::escape($base_string);
      $gallery
        ->addOption('languagelist', $base_string, FALSE);
    }
  }

  // Allow other modules to alter the built gallery data before it's
  // rendered. After this point the gallery should no longer change.
  $this->moduleManager
    ->alter('juicebox_gallery', $gallery, $data);
}