You are here

protected function JuiceboxXmlField::getJuiceboxFromData in Juicebox HTML5 Responsive Image Galleries 7.2

Helper to get a Juicebox gallery from a field.

Parameters

array $field: An associative field array to extract a gallery object from.

Return value

boolean Returns a Juicebox gallery object if a gallery is both found a built. Return NULL if no gallery can be extracted.

1 call to JuiceboxXmlField::getJuiceboxFromData()
JuiceboxXmlField::getXml in plugins/JuiceboxXmlField.inc
Get the XML based on loaded data.

File

plugins/JuiceboxXmlField.inc, line 135
Juicebox XML loader that's used to load (and build via loaded methods) the XML associated with a Drupal field formatter plugin.

Class

JuiceboxXmlField
Class to load and build the XML associated with a Drupal field formatter plugin.

Code

protected function getJuiceboxFromData($field) {

  // Within this context if the gallery has been initialized we know it has
  // also been built (as both happen together within
  // juicebox_field_build_gallery()).
  if (isset($field[0]['#juicebox']) && $field[0]['#juicebox']
    ->isInitialized()) {
    return $field[0]['#juicebox'];
  }
  return NULL;
}