public function JuiceboxGalleryDrupal::init in Juicebox HTML5 Responsive Image Galleries 7.2
Initialize in preparation to represent a specific gallery.
Parameters
array $id_args: An indexed array of simple string arguments that describe this gallery. This is typically based on the arguments that will be used to create a URL for the gallery XML, but no formal structure is strictly required. This information should uniquely identify the gallery.
array $settings: An associative array of settings data for this gallery. This will typically contain both generic gallery settings (that pertain to this object) as well as formatter settings (that are only used externally by a formatter plugin).
mixed $data: Drupal source data that was used to build the gallery. This is included purely for reference.
Overrides JuiceboxGalleryDrupalInterface::init
File
- includes/
JuiceboxGalleryDrupal.inc, line 42 - Class to extend a JuiceboxGalleryDecorator object with Drupal-specific logic and structures.
Class
- JuiceboxGalleryDrupal
- Class to extend a JuiceboxGalleryDecorator object with Drupal-specific logic and structures.
Code
public function init($id_args, $settings = array(), $data = NULL) {
// Set path for reference.
$this->idArgs = $id_args;
$this->settings = $settings;
$this->data = $data;
// Calculate and set the gallery ID.
$id = '';
foreach ($id_args as $arg) {
$id .= $arg . '--';
}
// Make sure no special characters slipped through inside individual args.
$id = trim(preg_replace('/[^0-9a-zA-Z-]/', '-', $id), '- ');
$this
->setId($id);
$this->initialized = TRUE;
}