You are here

function browsersync_page_bottom in Browsersync 8

Same name and namespace in other branches
  1. 8.2 browsersync.module \browsersync_page_bottom()

Implements hook_page_bottom().

Adds the Browsersync snippet to the bottom of the page.

File

./browsersync.module, line 141
Code for the Browsersync module.

Code

function browsersync_page_bottom(array &$page_bottom) {
  if (browsersync_get_setting('enabled') && \Drupal::currentUser()
    ->hasPermission('use browsersync')) {
    $page_bottom['browsersync'] = [
      '#theme' => 'browsersync_snippet',
      '#weight' => 100,
    ];
    foreach ([
      'host',
      'port',
    ] as $setting) {
      if ($value = browsersync_get_setting($setting)) {
        $page_bottom['browsersync']['#' . $setting] = $value;
      }
    }
  }
}