You are here

public function JuiceboxGallery::getImages in Juicebox HTML5 Responsive Image Galleries 8.2

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

Getter method for the gallery images.

Parameters

bool $filtered: If TRUE any output processing that is specified in the settings will be applied to the returned data (matching the processing that would happen upon rendering the XML). If FALSE the image data is returned in a raw format that matches what was input directly via addImage() or similar.

Return value

array Returns an array of images currently in the gallery.

Overrides JuiceboxGalleryInterface::getImages

1 call to JuiceboxGallery::getImages()
JuiceboxGallery::renderXml in src/JuiceboxGallery.php
Render the XML for Juicebox gallery once images and options are added.

File

src/JuiceboxGallery.php, line 137

Class

JuiceboxGallery
Class to generate the script and markup for a Juicebox gallery.

Namespace

Drupal\juicebox

Code

public function getImages($filtered = FALSE) {
  $images = $this->images;

  // If we are not returning the raw input data we need to apply any output
  // processing that may be specified in the object configuration.
  if ($filtered) {
    foreach ($images as &$image) {
      $image['title'] = !empty($this->settings['filter_markup']) ? $this
        ->filterMarkup($image['title']) : $image['title'];
      $image['caption'] = !empty($this->settings['filter_markup']) ? $this
        ->filterMarkup($image['caption']) : $image['caption'];
      $image['src_data'] = !empty($this->settings['process_attributes']) ? $this
        ->processAttributes($image['src_data']) : $image['src_data'];

      // Also derive linkURL and linkTarget values if they are not explicitly
      // set.
      if (!isset($image['src_data']['linkURL'])) {
        $image['src_data']['linkURL'] = $image['src_data']['imageURL'];
      }
      if (!isset($image['src_data']['linkTarget'])) {
        $image['src_data']['linkTarget'] = '_blank';
      }
    }
  }
  return $images;
}