forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
25 lines
726 B
PHP
25 lines
726 B
PHP
<?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();
|
|
}
|
|
}
|
|
}
|