function theme_switcher_configurable_language_delete in Theme Switcher Rules 8
Implements hook_ENTITY_TYPE_delete() for 'configurable_language'.
Delete the potential block visibility settings of the deleted language.
File
- ./
theme_switcher.module, line 77 - Contains hook implementations for Theme Switcher module.
Code
function theme_switcher_configurable_language_delete(ConfigurableLanguageInterface $language) {
foreach (ThemeSwitcherRule::loadMultiple() as $rule) {
$visibility = $rule
->getVisibility();
if (isset($visibility['language']['langcodes'][$language
->id()])) {
unset($visibility['language']['langcodes'][$language
->id()]);
$rule
->setVisibilityConfig('language', $visibility['language']);
$rule
->save();
}
}
}