Block::setVisibilityConfig

public Block::setVisibilityConfig($instance_id, array $configuration)

Sets the visibility condition configuration.

Parameters

string $instance_id: The condition instance ID.

array $configuration: The condition configuration.

Return value

$this

Overrides BlockInterface::setVisibilityConfig

File

core/modules/block/src/Entity/Block.php, line 258

Class

Block
Defines a Block configuration entity class.

Namespace

Drupal\block\Entity

Code

public function setVisibilityConfig($instance_id, array $configuration) {
  $conditions = $this->getVisibilityConditions();
  if (!$conditions->has($instance_id)) {
    $configuration['id'] = $instance_id;
    $conditions->addInstanceId($instance_id, $configuration);
  }
  else {
    $conditions->setInstanceConfiguration($instance_id, $configuration);
  }
  return $this;
}
doc_Drupal
2016-10-29 08:46:30
Comments
Leave a Comment

Please login to continue.