Skip to content
Snippets Groups Projects
Commit 4424f0ee authored by ambient.impact's avatar ambient.impact
Browse files

Updated hooks to work with new Config Devel issue fork:

parent 9fdf4f8c
Branches
Tags
1 merge request!17Updated hooks to work with new Config Devel issue fork and updated patch:
......@@ -17,9 +17,9 @@ function config_enforce_devel_form_alter(&$form, FormStateInterface &$form_state
}
/**
* Implements hook_config_devel_auto_import().
* Implements hook_config_devel_auto_import_files().
*/
function config_enforce_devel_config_devel_auto_import() {
function config_enforce_devel_config_devel_auto_import_files() {
return ConfigDevelHelper::autoImport();
}
......@@ -31,9 +31,9 @@ function config_enforce_devel_config_devel_post_auto_import($auto_import) {
}
/**
* Implements hook_config_devel_auto_export().
* Implements hook_config_devel_auto_export_files().
*/
function config_enforce_devel_config_devel_auto_export() {
function config_enforce_devel_config_devel_auto_export_files() {
return ConfigDevelHelper::autoExport();
}
......
......@@ -12,12 +12,12 @@ class ConfigDevelHelper {
/**
* Provide Config Devel module with configs to read from disk.
*
* @see hook_config_devel_auto_import()
* @see \config_enforce_devel_config_devel_auto_import_files()
*/
public static function autoImport() {
$auto_import = [];
foreach ((new EnforcedConfigCollection())->getEnforcedConfigs() as $config_name => $settings) {
$auto_import[$config_name] = [
$auto_import[] = [
'filename' => $settings['config_file_path'],
'hash' => isset($settings['hash']) ? $settings['hash'] : '',
];
......@@ -28,7 +28,7 @@ class ConfigDevelHelper {
/**
* Provide Config Devel module with config files to write to disk.
*
* @see hook_config_devel_auto_export()
* @see \config_enforce_devel_config_devel_auto_export_files()
*/
public static function autoExport() {
$auto_export = [];
......@@ -41,7 +41,7 @@ class ConfigDevelHelper {
/**
* Save hashes of auto-imported config files.
*
* @see config_enforce_devel_config_devel_post_auto_import()
* @see \config_enforce_devel_config_devel_post_auto_import()
*/
public static function postAutoImport(array $auto_import) {
$registries = (new TargetModuleCollection())->getRegistryConfigNames();
......@@ -52,6 +52,11 @@ class ConfigDevelHelper {
// @see EnforcedConfigRegistry::updateEnforcedConfigs().
if (in_array($config_name, $registries)) continue;
// Skip configs that we don't enforce.
if (!\array_key_exists($config_name, $enforced_configs)) {
continue;
}
// Check for missing hash elements, and fill them in to ensure they get regenerated.
if (!isset($results['hash'])) {
$results['hash'] = 'missing_from_config_devel_result';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment