185f9fe16d6fd206fffa7aaaf121199f1d5c717a
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Alter / PageAttachments.php
1 <?php
2
3 namespace Drupal\bootstrap\Plugin\Alter;
4
5 use Drupal\bootstrap\Plugin\PluginBase;
6
7 /**
8  * Implements hook_page_attachments_alter().
9  *
10  * @ingroup plugins_alter
11  *
12  * @BootstrapAlter("page_attachments")
13  */
14 class PageAttachments extends PluginBase implements AlterInterface {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function alter(&$attachments, &$context1 = NULL, &$context2 = NULL) {
20     if ($this->theme->livereloadUrl()) {
21       $attachments['#attached']['library'][] = 'bootstrap/livereload';
22     }
23     if ($this->theme->getSetting('popover_enabled')) {
24       $attachments['#attached']['library'][] = 'bootstrap/popover';
25     }
26     if ($this->theme->getSetting('tooltip_enabled')) {
27       $attachments['#attached']['library'][] = 'bootstrap/tooltip';
28     }
29     $attachments['#attached']['drupalSettings']['bootstrap'] = $this->theme->drupalSettings();
30   }
31
32 }