function Block::setVisibilityConfig

Same name in other branches
  1. 8.9.x core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::setVisibilityConfig()
  2. 10 core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::setVisibilityConfig()
  3. 11.x core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::setVisibilityConfig()

Overrides BlockInterface::setVisibilityConfig

File

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.