4 * Contains \Drupal\bootstrap\Plugin\Alter\PageAttachments.
7 namespace Drupal\bootstrap\Plugin\Alter;
9 use Drupal\bootstrap\Annotation\BootstrapAlter;
10 use Drupal\bootstrap\Plugin\PluginBase;
13 * Implements hook_page_attachments_alter().
15 * @ingroup plugins_alter
17 * @BootstrapAlter("page_attachments")
19 class PageAttachments extends PluginBase implements AlterInterface {
24 public function alter(&$attachments, &$context1 = NULL, &$context2 = NULL) {
25 if ($this->theme->livereloadUrl()) {
26 $attachments['#attached']['library'][] = 'bootstrap/livereload';
28 if ($this->theme->getSetting('popover_enabled')) {
29 $attachments['#attached']['library'][] = 'bootstrap/popover';
31 if ($this->theme->getSetting('tooltip_enabled')) {
32 $attachments['#attached']['library'][] = 'bootstrap/tooltip';
34 $attachments['#attached']['drupalSettings']['bootstrap'] = $this->theme->drupalSettings();