You are here

public function Container::setInsertionCondition in GoogleTagManager 8

Sets the configuration for an insertion condition.

@todo Does this need to set a persistent property?

Parameters

string $instance_id: The condition instance ID.

array $configuration: The condition configuration.

Return value

$this

File

src/Entity/Container.php, line 689

Class

Container
Defines the container configuration entity.

Namespace

Drupal\google_tag\Entity

Code

public function setInsertionCondition($instance_id, array $configuration) {
  $conditions = $this
    ->getInsertionConditions();
  if (!$conditions
    ->has($instance_id)) {
    $configuration['id'] = $instance_id;
    $conditions
      ->addInstanceId($instance_id, $configuration);
  }
  else {
    $conditions
      ->setInstanceConfiguration($instance_id, $configuration);
  }
  return $this;
}