You are here

function raven_page_attachments in Raven: Sentry Integration 8

Same name and namespace in other branches
  1. 8.2 raven.module \raven_page_attachments()
  2. 3.x raven.module \raven_page_attachments()

Implements hook_page_attachments().

File

./raven.module, line 6

Code

function raven_page_attachments(array &$page) {
  if (\Drupal::config('raven.settings')
    ->get('javascript_error_handler') && \Drupal::currentUser()
    ->hasPermission('send javascript errors to sentry')) {
    $page['#attached']['drupalSettings']['raven']['dsn'] = \Drupal::config('raven.settings')
      ->get('public_dsn');

    // Other modules can attach Raven.js options to the page.
    $page['#attached']['drupalSettings']['raven']['options'] = new \stdClass();
    $page['#attached']['library'][] = 'raven/raven';
  }
}