You are here

public function Container::snippets in GoogleTagManager 8

Returns array of JavaScript snippets.

Return value

array Associative array of snippets keyed by type: script, noscript and data_layer.

File

src/Entity/Container.php, line 240

Class

Container
Defines the container configuration entity.

Namespace

Drupal\google_tag\Entity

Code

public function snippets() {
  $snippets = [
    'script' => $this
      ->scriptSnippet(),
    'noscript' => $this
      ->noscriptSnippet(),
    'data_layer' => $this
      ->dataLayerSnippet(),
  ];

  // Allow other modules to alter the snippets.
  \Drupal::moduleHandler()
    ->alter('google_tag_snippets', $snippets, $this);
  return $snippets;
}