Skip to content
Snippets Groups Projects
Commit 40689f66 authored by jurgenhaas's avatar jurgenhaas
Browse files

Update patch for config_devel

parent e90fbcc9
No related branches found
Tags v1.1.0
1 merge request!314Merging develop into main
......@@ -36,7 +36,7 @@
},
"drupal/config_devel": {
"#3219083 Export raw data": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3219083.diff",
"#3227881 Support config_rewrite": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3227881.diff"
"#3227881 Support config_rewrite": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3227881.diff?v=2"
},
"drupal/config_sync": {
"#3176955 Drupal 9 test compatibility": "https://www.drupal.org/files/issues/2021-03-19/config_sync-config-sync-test-core-3176955-4.patch"
......
......@@ -32,7 +32,7 @@
},
"drupal/config_devel": {
"#3219083 Export raw data": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3219083.diff",
"#3227881 Support config_rewrite": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3227881.diff"
"#3227881 Support config_rewrite": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3227881.diff?v=2"
},
"drupal/config_sync": {
"#3176955 Drupal 9 test compatibility": "https://www.drupal.org/files/issues/2021-03-19/config_sync-config-sync-test-core-3176955-4.patch"
......
diff --git a/src/Commands/ConfigDevelCommands.php b/src/Commands/ConfigDevelCommands.php
index a99098a25d1b4e352a200243f8d9b3ab9889f92f..e282c77dfca9f251b412d0e359da0e0607f91ebf 100644
index ad76144d17fa4c77d6df9318243220b0c258cfe4..9bb354fef0982f9658fb430e5f25d842c6811f87 100644
--- a/src/Commands/ConfigDevelCommands.php
+++ b/src/Commands/ConfigDevelCommands.php
@@ -4,6 +4,7 @@ namespace Drupal\config_devel\Commands;
......@@ -25,34 +25,38 @@ index a99098a25d1b4e352a200243f8d9b3ab9889f92f..e282c77dfca9f251b412d0e359da0e06
}
+
+ // If we have any rewrite configuration, export that as well.
+ if (isset($config['rewrite']) && interface_exists('Drupal\config_rewrite\ConfigRewriterInterface')) {
+ if (isset($config['rewrite']) && $this->moduleHandler->moduleExists('config_rewrite')) {
+ $this->exportConfig($config['rewrite'], $type, $extension, ConfigRewriterInterface::CONFIG_REWRITE_DIRECTORY);
+ }
}
/**
@@ -164,6 +172,8 @@ class ConfigDevelCommands extends DrushCommands {
@@ -164,6 +172,12 @@ class ConfigDevelCommands extends DrushCommands {
* - field.instance.node.article.body
* optional:
* - field.instance.node.article.tags
+ * rewrite:
+ * - book.settings
+ *
+ * The 'rewrite' key may contain config entities that could override config
+ * from other modules and is only taking any action, if the config_rewrite
+ * module is being installed.
*
* @command config:devel-import
* @param string $extension Machine name of the module, profile or theme.
@@ -198,6 +208,11 @@ class ConfigDevelCommands extends DrushCommands {
@@ -198,6 +212,11 @@ class ConfigDevelCommands extends DrushCommands {
if (isset($config['optional'])) {
$this->importConfig($config['optional'], $type, $extension, InstallStorage::CONFIG_OPTIONAL_DIRECTORY);
}
+
+ // Import rewrite config
+ if (isset($config['rewrite']) && interface_exists('Drupal\config_rewrite\ConfigRewriterInterface')) {
+ // Import rewrite config.
+ if (isset($config['rewrite']) && $this->moduleHandler->moduleExists('config_rewrite')) {
+ $this->importConfig($config['rewrite'], $type, $extension, ConfigRewriterInterface::CONFIG_REWRITE_DIRECTORY);
+ }
}
/**
@@ -213,6 +228,8 @@ class ConfigDevelCommands extends DrushCommands {
@@ -213,6 +232,8 @@ class ConfigDevelCommands extends DrushCommands {
* - field.instance.node.article.body
* optional:
* - field.instance.node.article.tags
......@@ -61,17 +65,17 @@ index a99098a25d1b4e352a200243f8d9b3ab9889f92f..e282c77dfca9f251b412d0e359da0e06
*
* @command config:devel-import-one
* @param string $path Config file name.
@@ -284,7 +301,7 @@ class ConfigDevelCommands extends DrushCommands {
@@ -284,7 +305,7 @@ class ConfigDevelCommands extends DrushCommands {
* The name of the extension for which to return the config.
*
* @return array
- * An array containing install and optional config.
+ * An array containing install, optional and rewrite config.
*/
protected function getExtensionConfig($type, $extension) {
$filename = drupal_get_path($type, $extension) . '/' . $extension .'.info.yml';
@@ -294,14 +311,14 @@ class ConfigDevelCommands extends DrushCommands {
if (isset($info['config_devel'])) {
*
* @throws \Exception
* Throws an exception if the 'config_devel' property of the extension's
@@ -302,14 +323,14 @@ class ConfigDevelCommands extends DrushCommands {
// Keep backwards compatibility for the old format. This has config names
// listed directly beneath 'config_devel', rather than an intermediate
- // level for 'install' and 'optional'.
......@@ -88,7 +92,7 @@ index a99098a25d1b4e352a200243f8d9b3ab9889f92f..e282c77dfca9f251b412d0e359da0e06
if (isset($info['config_devel'][$type])) {
$config[$type] = $info['config_devel'][$type];
}
@@ -323,8 +340,9 @@ class ConfigDevelCommands extends DrushCommands {
@@ -331,8 +352,9 @@ class ConfigDevelCommands extends DrushCommands {
* The name of the extension we're exporting.
* @param string $directory
* The subdirectory within the extension that we're exporting to. One of
......@@ -100,7 +104,7 @@ index a99098a25d1b4e352a200243f8d9b3ab9889f92f..e282c77dfca9f251b412d0e359da0e06
*
* @throws \Exception
* Thrown when the directory to export to is missing and could not be
@@ -368,8 +386,9 @@ class ConfigDevelCommands extends DrushCommands {
@@ -376,8 +398,9 @@ class ConfigDevelCommands extends DrushCommands {
* The module, theme or install profile we're importing.
* @param string $directory
* The subdirectory within the extension that we're importing from. One of
......@@ -111,4 +115,4 @@ index a99098a25d1b4e352a200243f8d9b3ab9889f92f..e282c77dfca9f251b412d0e359da0e06
+ * - \Drupal\config_rewrite\ConfigRewriterInterface::CONFIG_REWRITE_DIRECTORY
*/
protected function importConfig($config_list, $type, $extension, $directory) {
$config_path = drupal_get_path($type, $extension) . "/$directory";
$config_path = \Drupal::service('extension.path.resolver')->getPath($type, $extension) . "/$directory";
......@@ -36,7 +36,7 @@
},
"drupal/config_devel": {
"#3219083 Export raw data": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3219083.diff",
"#3227881 Support config_rewrite": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3227881.diff"
"#3227881 Support config_rewrite": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3227881.diff?v=2"
},
"drupal/config_sync": {
"#3176955 Drupal 9 test compatibility": "https://www.drupal.org/files/issues/2021-03-19/config_sync-config-sync-test-core-3176955-4.patch"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment