protected function BlazyManager::buildContent in Blazy 8.2
Build out (rich media) content.
1 call to BlazyManager::buildContent()
- BlazyManager::prepareBlazy in src/
BlazyManager.php - Prepares the Blazy output as a structured array ready for ::renderer().
File
- src/
BlazyManager.php, line 180
Class
- BlazyManager
- Implements a public facing blazy manager.
Namespace
Drupal\blazyCode
protected function buildContent(array &$element, array &$build) {
$settings =& $build['settings'];
if (empty($build['content'])) {
return;
}
// Prevents complication for now, such as lightbox for Facebook, etc.
// Either makes no sense, or not currently supported without extra legs.
// Original formatter settings can still be accessed via content variable.
$settings = array_merge($settings, BlazyDefault::richSettings());
// Supports HTML content for lightboxes as long as having image trigger.
// Type rich to not conflict with Image rendered by its formatter option.
$rich = $settings['type'] == 'rich' && !empty($settings['_richbox']);
if ($rich && isset($build['content'][0]['#settings']) && ($blazy = $build['content'][0]['#settings'])) {
if (!empty($settings['_hires']) && $blazy
->get('lightbox')) {
// Overrides the overriden settings with original formatter settings.
$settings = array_merge($settings, $blazy
->storage());
$element['#lightbox_html'] = $build['content'];
$build['content'] = [];
}
}
}