Issue #3385934 by phthlaap, joegraduate, useernamee, alexpott: The configuration synchronization page encounters errors when core.extension.yml is missing in the config/sync directory

(cherry picked from commit 96a211c7b0)
merge-requests/8129/head
Lee Rowlands 2024-05-20 09:37:47 +10:00
parent 58cd9ce083
commit 563e9a6812
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
2 changed files with 17 additions and 3 deletions

View File

@ -314,11 +314,11 @@ function field_config_import_steps_alter(&$sync_steps, ConfigImporter $config_im
* @see \Drupal\field\ConfigImporterFieldPurger
*/
function field_form_config_admin_import_form_alter(&$form, FormStateInterface $form_state) {
// Only display the message when there is a storage comparer available and the
// form is not submitted.
// Only display the message when core.extension is available in the source
// storage and the form is not submitted.
$user_input = $form_state->getUserInput();
$storage_comparer = $form_state->get('storage_comparer');
if ($storage_comparer && empty($user_input)) {
if ($storage_comparer?->getSourceStorage()->exists('core.extension') && empty($user_input)) {
$field_storages = ConfigImporterFieldPurger::getFieldStoragesToPurge(
$storage_comparer->getSourceStorage()->read('core.extension'),
$storage_comparer->getChangelist('delete')

View File

@ -130,4 +130,18 @@ class FieldImportDeleteUninstallUiTest extends FieldTestBase {
$this->assertFalse(isset($deleted_storages[$field_storage->uuid()]), 'Text field has been completed removed from the system.');
}
/**
* Tests if the synchronization form is available when the core.extension.yml is missing.
*/
public function testSynchronizeForm(): void {
$sync = $this->container->get('config.storage.sync');
$this->copyConfig($this->container->get('config.storage'), $sync);
$sync->delete('core.extension');
$this->drupalGet('admin/config/development/configuration');
$assertSession = $this->assertSession();
$this->assertSession()->elementExists('css', 'input[value="Import all"]')->click();
$assertSession->pageTextContains('The core.extension configuration does not exist.');
}
}