You are here

public function Container::__construct in GoogleTagManager 8

Constructs an Entity object.

Parameters

array $values: An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.

string $entity_type: The type of the entity to create.

Overrides ConfigEntityBase::__construct

File

src/Entity/Container.php, line 220

Class

Container
Defines the container configuration entity.

Namespace

Drupal\google_tag\Entity

Code

public function __construct(array $values, $entity_type) {
  parent::__construct($values, $entity_type);
  $values = array_diff_key($values, array_flip([
    'uuid',
    'langcode',
  ]));
  if (empty($values)) {

    // Initialize entity properties from default container settings.
    $config = \Drupal::config('google_tag.settings');
    foreach ($config
      ->get('_default_container') as $key => $value) {
      $this->{$key} = $value;
    }
  }
}