You are here

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

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

Update an existing image in the gallery.

This duplicates the functionality of addImage() with an $override_id but is included as a separate method for convenience.

Parameters

int $image_id: The id of an existing image, already added to the gallery, to update with new data. This id should match the index for the image as returned by getImages().

array $src_data: Associative array containing all the source data for a gallery image, including the:

  • image_url: URL to the full image to display.
  • thumb_url: URL to the thumbnail to display for the image.
  • link_url: The Juicebox "link URL" value for the image.
  • link_target: The browser target value to use when following a link URL.

string $title: The title markup to display for the image.

string $caption: The caption markup to display for the image.

bool $filter: Optional. Whether-or-not to filter the $title and $caption values for syntactic compatibility with Juicebox.

Return value

bool Returns TRUE on successful update and FALSE on failure.

Overrides JuiceboxGalleryInterface::updateImage

File

src/JuiceboxGallery.php, line 128

Class

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

Namespace

Drupal\juicebox

Code

public function updateImage($image_id, array $src_data = [], $title = '', $caption = '', $filter = TRUE) {

  // Updating can be accomplished with addImage(), so just pass-through the
  // needed params.
  return $this
    ->addImage($src_data, $title, $caption, $filter, $image_id);
}