Commit 7ed24a5a authored by catch's avatar catch
Browse files

Issue #2728507 by Lendude, Kristen Pol, pameeela: Not selecting an entity type...

Issue #2728507 by Lendude, Kristen Pol, pameeela: Not selecting an entity type on Config import single leads to a fatal error

(cherry picked from commit c976dbbf)
parent 1b823bcd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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');

+4 −0
Original line number Diff line number Diff line
@@ -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.');
  }

  /**