You are here

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

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

Add a new Juicebox configuration option to the gallery.

Parameters

string $option_name: The option name/key to add. camelCase names keys are preferred but underscore-separated (e.g., my_setting) and dash-separated (e.g., my-seting) values are also accepted when 'process_attributes' legacy support is active (i.e. when the 'process_attributes' setting was activated when the gallery was instantiated).

string $option_value: The option value to add.

bool $override: Whether-or-not to override any values that already exist for the passed name/key.

Return value

bool Returns TRUE on successful addition and FALSE on failure.

Overrides JuiceboxGalleryInterface::addOption

File

src/JuiceboxGallery.php, line 173

Class

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

Namespace

Drupal\juicebox

Code

public function addOption($option_name, $option_value, $override = TRUE) {

  // Always use lowercase keys to allow for future lookups.
  $option_name = strtolower($option_name);
  if (!empty($this->options[$option_name]) && !$override) {
    return FALSE;
  }

  // Add option,.
  $this->options[$option_name] = $option_value;
  return TRUE;
}