public function Block::setVisibilityConfig in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::setVisibilityConfig()
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 268
Class
- Block
- Defines a Block configuration entity class.
Namespace
Drupal\block\EntityCode
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;
}