public function BlazyLibrary::pageBuild in Blazy 7
Implements hook_page_build().
File
- src/
BlazyLibrary.php, line 225
Class
- BlazyLibrary
- Provides Blazy library definitions.
Namespace
Drupal\blazyCode
public function pageBuild(&$page) {
// We do this here because no attachments are supported at filter D7.
if ($this
->isActive() && ($filters = $this->manager
->config('filters', [], 'blazy.settings'))) {
$attach = [
'blazy' => TRUE,
'filter' => TRUE,
'ratio' => TRUE,
];
foreach ($filters as $format) {
// Prevents blocking field formatters since this is done globally.
if (isset($format['media_switch']) && ($switch = $format['media_switch'])) {
$attach[$switch] = $switch;
}
foreach ([
'column',
'grid',
] as $key) {
if (isset($format[$key]) && $format[$key]) {
$attach[$key] = $format[$key];
}
}
}
$page['page_bottom']['blazy']['#attached'] = $this->manager
->attach($attach);
}
}