public function ConfigRewriter::rewriteModuleConfig in Configuration Rewrite 8.2
Same name and namespace in other branches
- 8 src/ConfigRewriter.php \Drupal\config_rewrite\ConfigRewriter::rewriteModuleConfig()
Rewrites configuration for a given module.
Parameters
$module: The name of a module (without the .module extension).
Overrides ConfigRewriterInterface::rewriteModuleConfig
File
- src/
ConfigRewriter.php, line 90
Class
- ConfigRewriter
- Provides methods to rewrite configuration.
Namespace
Drupal\config_rewriteCode
public function rewriteModuleConfig($module) {
// Load the module extension.
$extension = $this->moduleHandler
->getModule($module);
// Config rewrites are stored in 'modulename/config/rewrite'.
$dir_base = $extension
->getPath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'rewrite';
$languages = \Drupal::languageManager()
->getLanguages();
// Rewrite configuration for the default language.
$this
->rewriteDirectoryConfig($extension, $dir_base);
// Rewrite configuration for each enabled language.
foreach ($languages as $langcode => $language) {
$rewrite_dir = $dir_base . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR . $langcode;
$this
->rewriteDirectoryConfig($extension, $rewrite_dir, $langcode);
}
}