Skip to content

Commit

Permalink
Issue #2728507 by Lendude, Kristen Pol, pameeela: Not selecting an en…
Browse files Browse the repository at this point in the history
…tity type on Config import single leads to a fatal error

(cherry picked from commit c976dbbfd31e986dd4dbc0fe9adea891ee1e8bd2)
  • Loading branch information
catch committed Jul 20, 2020
1 parent c629cef commit 5e79d23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/config/src/Form/ConfigSingleImportForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
}

// Validate for config entities.
if ($form_state->getValue('config_type') !== 'system.simple') {
if ($form_state->getValue('config_type') && $form_state->getValue('config_type') !== 'system.simple') {
$definition = $this->entityTypeManager->getDefinition($form_state->getValue('config_type'));
$id_key = $definition->getKey('id');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ public function testImportSimpleConfiguration() {
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import'));
$this->assertText(t('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.'));

// Try to import without any values.
$this->drupalPostForm('admin/config/development/configuration/single/import', [], t('Import'));
$this->assertText('Configuration type field is required.');
$this->assertText('Paste your configuration here field is required.');
}

/**
Expand Down

0 comments on commit 5e79d23

Please sign in to comment.