3 namespace Drupal\bootstrap\Plugin\Alter;
5 use Drupal\bootstrap\Plugin\PluginBase;
8 * Implements hook_page_attachments_alter().
10 * @ingroup plugins_alter
12 * @BootstrapAlter("page_attachments")
14 class PageAttachments extends PluginBase implements AlterInterface {
19 public function alter(&$attachments, &$context1 = NULL, &$context2 = NULL) {
20 if ($this->theme->livereloadUrl()) {
21 $attachments['#attached']['library'][] = 'bootstrap/livereload';
23 if ($this->theme->getSetting('popover_enabled')) {
24 $attachments['#attached']['library'][] = 'bootstrap/popover';
26 if ($this->theme->getSetting('tooltip_enabled')) {
27 $attachments['#attached']['library'][] = 'bootstrap/tooltip';
29 $attachments['#attached']['drupalSettings']['bootstrap'] = $this->theme->drupalSettings();