You are here

public function ContainerManager::createAllAssets in GoogleTagManager 8

Prepares directory for and saves snippet files for all containers.

Return value

bool Whether the files were saved.

Overrides ContainerManagerInterface::createAllAssets

File

src/Entity/ContainerManager.php, line 221

Class

ContainerManager
Defines the Google tag container manager.

Namespace

Drupal\google_tag\Entity

Code

public function createAllAssets() {
  $ids = $this
    ->loadContainerIDs();
  if (!$ids) {
    return TRUE;
  }

  // Create snippet files for enabled containers.
  $containers = $this->entityTypeManager
    ->getStorage('google_tag_container')
    ->loadMultiple($ids);
  $result = TRUE;
  foreach ($containers as $container) {
    $result = !$this
      ->createAssets($container) ? FALSE : $result;
  }
  return $result;
}