function rabbit_hole_update_8101 in Rabbit Hole 2.x
Same name and namespace in other branches
- 8 rabbit_hole.install \rabbit_hole_update_8101()
Update redirect_fallback_action field default values.
File
- ./
rabbit_hole.install, line 34 - Install, update and uninstall functions for the Rabbit Hole module.
Code
function rabbit_hole_update_8101() {
/** @var \Drupal\Core\Config\ConfigFactoryInterface $configFactory */
$configFactory = \Drupal::configFactory();
/** @var \Drupal\Core\Config\StorageInterface $configStorage */
$configStorage = \Drupal::service('config.storage');
foreach ($configStorage
->listAll('rabbit_hole.behavior_settings') as $configName) {
$config = $configFactory
->getEditable($configName);
if (!$config
->get('redirect_fallback_action')) {
$config
->set('redirect_fallback_action', 'access_denied')
->save();
}
}
}