You are here

public function GTMContainer::__construct in GoogleTagManager 7.2

Constructs a container configuration object.

Parameters

array $values: Associative array of container properties keyed by property name.

string $name: (optional) Machine name of container to load.

File

includes/entity/container.inc, line 158

Class

GTMContainer
Defines the container configuration entity.

Code

public function __construct(array $values, $name = NULL) {
  if (empty($values) && $name) {

    // $values = (array) ctools_export_crud_load('gtag_config', "google_tag.container.$name");
    $values = (array) gtag_export_crud_load('gtag_config', "google_tag.container.{$name}");
  }

  // @todo Always append default container values to mimic variable_get()?
  foreach ($values as $key => $value) {
    $this->{$key} = $value;
  }

  /*
      $values = array_diff_key($values, array_flip(['uuid', 'langcode']));
      if (empty($values)) {
        // Initialize entity properties from default container settings.
        $config = \GTMSettings::getInstance();
        foreach ($config->get('_default_container') as $key => $value) {
          $this->$key = $value;
        }
      }
  */
}