Commit 5860e3c9 authored by eelkeblok's avatar eelkeblok Committed by nord102

Issue #3002832 by eelkeblok, jrockowitz, gapple, capuleto: Remove index from configuration export

parent d9080066
......@@ -11,3 +11,13 @@
function config_ignore_update_8201() {
\Drupal::getContainer()->get('module_installer')->install(['config_filter']);
}
/**
* Remove index from configuration export.
*/
function config_ignore_update_8202() {
$config = \Drupal::configFactory()->getEditable('config_ignore.settings');
$ignored_config_entities = $config->get('ignored_config_entities') ?: [];
$config->set('ignored_config_entities', array_values($ignored_config_entities));
$config->save();
}
......@@ -63,8 +63,9 @@ Examples: <ul>
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state->getValues();
$config_ignore_settings = $this->config('config_ignore.settings');
$config_ignore_settings_array = preg_split("[\n|\r]", $values['ignored_config_entities']);
$config_ignore_settings_array = preg_split("/[\r\n]+/", $values['ignored_config_entities']);
$config_ignore_settings_array = array_filter($config_ignore_settings_array);
$config_ignore_settings_array = array_values($config_ignore_settings_array);
$config_ignore_settings->set('ignored_config_entities', $config_ignore_settings_array);
$config_ignore_settings->save();
parent::submitForm($form, $form_state);
......
......@@ -58,7 +58,7 @@ class ConfigIgnoreTest extends ConfigIgnoreBrowserTestBase {
$this->drupalLogin($this->drupalCreateUser(['import configuration']));
$edit = [
'ignored_config_entities' => 'config.test',
'ignored_config_entities' => 'config.test_01' . "\r\n" . 'config.test_02',
];
$this->drupalGet('admin/config/development/configuration/ignore');
......@@ -66,7 +66,7 @@ class ConfigIgnoreTest extends ConfigIgnoreBrowserTestBase {
$settings = $this->config('config_ignore.settings')->get('ignored_config_entities');
$this->assertEqual($settings, ['config.test']);
$this->assertEquals(['config.test_01', 'config.test_02'], $settings);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment