You are here

function eloqua_page_attachments in Eloqua 8

Implements hook_page_attachments().

Sets site identifier and adds Eloqua tracking code.

See also

\Drupal\eloqua\EventSubscriber

File

./eloqua.module, line 19
Eloqua Integration Module

Code

function eloqua_page_attachments(array &$page) {
  $config = \Drupal::config('eloqua.settings');
  $state = \Drupal::state()
    ->get('eloqua.condition_result') ?: 0;
  if (null !== $config
    ->get('site_identifier') && $state) {
    $page['#attached']['drupalSettings']['eloqua']['siteID'] = $config
      ->get('site_identifier');
    $page['#attached']['library'][] = 'eloqua/eloqua';
  }
}