You are here

public function GTMContainerManager::loadContainers in GoogleTagManager 7.2

Returns the container entities sorted by weight.

@todo Implement status property and filter on it.

Return value

array The array of container entity objects.

3 calls to GTMContainerManager::loadContainers()
GTMContainerManager::createAllAssets in includes/entity/manager.inc
Prepares directory for and saves snippet files for all containers.
GTMContainerManager::getNoScriptAttachments in includes/entity/manager.inc
Adds render array items of page top attachments.
GTMContainerManager::getScriptAttachments in includes/entity/manager.inc
Adds render array items of page attachments.

File

includes/entity/manager.inc, line 101

Class

GTMContainerManager
Defines the Google tag container manager.

Code

public function loadContainers() {
  static $containers;
  if (!isset($containers)) {
    ctools_include('export');
    $keys = array_flip(array(
      'settings',
    ));
    $objects = ctools_export_load_object('gtag_config', 'all');
    $objects = array_diff_key($objects, $keys);
    $containers = array();
    foreach ($objects as $object) {
      $containers[] = new GTMContainer((array) $object);
    }
    usort($containers, function ($a, $b) {
      return (int) $b->weight < (int) $a->weight;
    });
  }
  return $containers;
}