You are here

function blazy_test_blazy_attach_alter in Blazy 8

Same name and namespace in other branches
  1. 8.2 tests/modules/blazy_test/blazy_test.module \blazy_test_blazy_attach_alter()

Implements hook_blazy_attach_alter().

File

tests/modules/blazy_test/blazy_test.module, line 28
Testing various Blazy hooks, etc.

Code

function blazy_test_blazy_attach_alter(array &$load, array $settings = []) {
  if (!empty($settings['blazy_test'])) {
    $load['library'][] = 'foo/fake_library';
    $manager = \Drupal::service('blazy.manager');
    $template = [
      '#theme' => 'blazy_test',
    ];
    $load['drupalSettings']['blazy_test'] = [
      'options' => [
        'slideshow' => TRUE,
      ],
      'container' => $manager
        ->getRenderer()
        ->renderPlain($template),
    ];
  }
}