You are here

public function AssetInjectorBase::setConditionsConfig in Asset Injector 8.2

Sets the conditions condition configuration.

Parameters

string $instance_id: The condition instance ID.

array $configuration: The condition configuration.

Return value

$this

Overrides AssetInjectorInterface::setConditionsConfig

File

src/Entity/AssetInjectorBase.php, line 163

Class

AssetInjectorBase
Class AssetInjectorBase: Base asset injector class.

Namespace

Drupal\asset_injector\Entity

Code

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