You are here

function _datalayer_defaults in dataLayer 8

Same name and namespace in other branches
  1. 7 datalayer.module \_datalayer_defaults()

Defines Drupal-wide data layer defaults.

2 calls to _datalayer_defaults()
DataLayerKernelTest::testDataLayerDefaults in tests/src/Kernel/DataLayerKernelTest.php
Test DataLayer Defaults function.
datalayer_add in ./datalayer.module
Allow adding to the data layer easy on the fly, similar to drupal_add_js().

File

./datalayer.module, line 405
Client-side data space.

Code

function _datalayer_defaults() {
  $datalayer_settings = \Drupal::config('datalayer.settings');
  $language = \Drupal::languageManager()
    ->getDefaultLanguage();
  $site_config = \Drupal::config('system.date');
  $site_name = \Drupal::config('system.site');
  return [
    $datalayer_settings
      ->get('drupal_language') => $language
      ->getId(),
    $datalayer_settings
      ->get('drupal_country') => $site_config
      ->get('country.default'),
    $datalayer_settings
      ->get('site_name') => $site_name
      ->get('name'),
  ];
}