public function BlazyManager::getBlazy in Blazy 8
Same name and namespace in other branches
- 8.2 src/BlazyManager.php \Drupal\blazy\BlazyManager::getBlazy()
- 7 src/BlazyManager.php \Drupal\blazy\BlazyManager::getBlazy()
Returns the enforced content, or image using theme_blazy().
Parameters
array $build: The array containing: item, content, settings, or optional captions.
Return value
array The alterable and renderable array of enforced content, or theme_blazy().
1 call to BlazyManager::getBlazy()
- BlazyManager::getImage in src/
BlazyManager.php - Backported few cross-module methods to minimize mismatched branch issues.
File
- src/
BlazyManager.php, line 232
Class
- BlazyManager
- Implements a public facing blazy manager.
Namespace
Drupal\blazyCode
public function getBlazy(array $build = []) {
foreach (BlazyDefault::themeProperties() as $key) {
$build[$key] = isset($build[$key]) ? $build[$key] : [];
}
$settings =& $build['settings'];
$settings += BlazyDefault::itemSettings();
// Respects content not handled by theme_blazy(), but passed through.
if (empty($build['content'])) {
$image = [
'#theme' => $settings['theme_hook_image'] ?: 'blazy',
'#delta' => $settings['delta'],
'#item' => $settings['entity_type_id'] == 'user' ? $build['item'] : [],
'#image_style' => $settings['image_style'],
'#build' => $build,
'#pre_render' => [
[
$this,
'preRenderImage',
],
],
];
}
else {
$image = $build['content'];
}
$this
->getModuleHandler()
->alter('blazy', $image, $settings);
return $image;
}