block_visibility_groups.install in Block Visibility Groups 8
Install, update and uninstall functions for the block_visibility_groups module.
File
block_visibility_groups.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the block_visibility_groups module.
*/
/**
* Implements hook_uninstall().
*/
function block_visibility_groups_uninstall() {
// Remove the 'condition_group' condition from all blocks.
/** @var \Drupal\Core\Entity\EntityStorageInterface $block_storage */
$block_storage = \Drupal::service('entity_type.manager')
->getStorage('block');
/** @var \Drupal\block\Entity\Block[] $blocks */
$blocks = $block_storage
->loadMultiple();
foreach ($blocks as $block) {
$conditions = $block
->getVisibilityConditions();
if ($conditions
->has('condition_group')) {
$conditions
->removeInstanceId('condition_group');
$block
->save();
}
}
}
Functions
Name | Description |
---|---|
block_visibility_groups_uninstall | Implements hook_uninstall(). |