protected function BlazyManager::prepareBuild in Blazy 7
Same name and namespace in other branches
- 8.2 src/BlazyManager.php \Drupal\blazy\BlazyManager::prepareBuild()
Prepares Blazy outputs, extract items, and returns updated $settings.
2 calls to BlazyManager::prepareBuild()
- BlazyManager::build in src/
BlazyManager.php - Returns the entire contents using theme_field(), or theme_item_list().
- BlazyManager::preRenderBuild in src/
BlazyManager.php - Builds the Blazy outputs as a structured array ready for ::renderer().
File
- src/
BlazyManager.php, line 432
Class
- BlazyManager
- Implements a public facing blazy manager.
Namespace
Drupal\blazyCode
protected function prepareBuild(array &$build) {
// If children are stored within items, reset.
// Blazy comes late to the party after sub-modules decided what they want.
$settings = isset($build['settings']) ? $build['settings'] : [];
$settings += $this
->getCommonSettings() + BlazyDefault::htmlSettings();
$build = isset($build['items']) ? $build['items'] : $build;
// Supports Blazy multi-breakpoint images if provided, updates $settings.
// Cases: Blazy within Views gallery, or references without direct image.
if (!empty($settings['first_image']) && !empty($settings['check_blazy'])) {
// Views may flatten out the array, bail out.
// What we do here is extract the formatter settings from the first found
// image and pass its settings to this container so that Blazy Grid which
// lacks of settings may know if it should load/ display a lightbox, etc.
// Lightbox should work without `Use field template` checked.
if (is_array($settings['first_image'])) {
$this
->isBlazy($settings, $settings['first_image']);
}
}
unset($build['items'], $build['settings']);
return $settings;
}