diff -u b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php --- b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php +++ b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php @@ -120,15 +120,15 @@ $build = array(); - $build['#title'] = t('View changes of @config_file', array('@config_file' => $source_name)); + $build['#title'] = $this->t('View changes of @config_file', array('@config_file' => $source_name)); // Add the CSS for the inline diff. $build['#attached']['css'][] = drupal_get_path('module', 'system') . '/css/system.diff.css'; $build['diff'] = array( '#type' => 'table', '#header' => array( - array('data' => t('Old'), 'colspan' => '2'), - array('data' => t('New'), 'colspan' => '2'), + array('data' => $this->t('Old'), 'colspan' => '2'), + array('data' => $this->t('New'), 'colspan' => '2'), ), '#rows' => $formatter->format($diff), ); @@ -161,12 +161,12 @@ $build['#attached']['css'][] = drupal_get_path('module', 'system') . '/css/system.diff.css'; if ($storage == 'active') { - $build['#title'] = t('View changes between snapshot and active configuration.'); + $build['#title'] = $this->t('View changes between snapshot and active configuration.'); $used_storage = $this->targetStorage; $compare_button = $this->l($this->t('Compare snapshot with staging storage'), 'config.snapshot_diff', array('storage' => 'staging'), array('attributes' => array('class' => array('button')))); } else { - $build['#title'] = t('View changes between snapshot and staging configuration.'); + $build['#title'] = $this->t('View changes between snapshot and staging configuration.'); $used_storage = $this->sourceStorage; $compare_button = $this->l($this->t('Compare snapshot with active storage'), 'config.snapshot_diff', array('storage' => 'active'), array('attributes' => array('class' => array('button')))); } @@ -192,8 +192,8 @@ '#prefix' => '

' . $name . '

', '#type' => 'table', '#header' => array( - array('data' => t('Snapshot'), 'colspan' => '2'), - array('data' => ($storage == 'active') ? t('Active storage') : t('Staging storage'), 'colspan' => '2'), + array('data' => $this->t('Snapshot'), 'colspan' => '2'), + array('data' => ($storage == 'active') ? $this->t('Active storage') : $this->t('Staging storage'), 'colspan' => '2'), ), '#rows' => $formatter->format($diff), ); diff -u b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php --- b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php +++ b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php @@ -168,7 +168,7 @@ // Verify that we have an initial snapshot that matches the active // configuration. - if ($active_snapshot_comparer->createChangelist()->hasChanges()) { + if (empty($form_state['input']) && $active_snapshot_comparer->createChangelist()->hasChanges()) { drupal_set_message($this->t('Changes have been made to your active configuration, which might be lost on the next import attempt. You can find and review the differences between snapshot and active/staging storage here: Compare snapshot and active/staging storage.', array( '@link' => $this->url('config.snapshot_diff', array('storage' => 'active')))), 'warning'); diff -u b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php --- b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigExportImportUITest.php @@ -128,23 +128,34 @@ $this->assertEqual(\Drupal::config('system.site')->get('slogan'), $this->newSlogan); + $this->drupalGet('node/add'); + $this->assertFieldByName("{$this->field->name}[0][value]", '', 'Widget is displayed'); + } + + /** + * Tests a warning appears when unsynchronized changes exist.. + */ + public function testImportWarning() { + $new_slogan = $this->randomName(16); + \Drupal::config('system.site') + ->set('slogan', $new_slogan) + ->save(); + + $this->drupalGet('admin/config/development/configuration'); + $this->assertText('Changes have been made to your active configuration, which might be lost on the next import attempt. ' . 'You can find and review the differences between snapshot and active/staging storage here'); - $changed_slogan = $this->randomName(16); + $this->drupalGet('admin/config/development/configuration/full/import'); - \Drupal::config('system.site') - ->set('slogan', $changed_slogan) - ->save(); + $this->assertText('Changes have been made to your active configuration, which might be lost on the next import attempt. ' . + 'You can find and review the differences between snapshot and active/staging storage here'); $this->clickLink('Compare snapshot and active/staging storage'); $this->assertText('View changes between snapshot and active configuration'); $this->assertText('system.site'); $this->assertText('Active storage'); - $this->assertText($changed_slogan, "Changed slogan $changed_slogan found when viewing changes."); + $this->assertText($new_slogan, "New slogan $new_slogan found when viewing changes."); $this->clickLink('Compare snapshot with staging storage'); $this->assertText('View changes between snapshot and staging configuration'); - - $this->drupalGet('node/add'); - $this->assertFieldByName("{$this->field->name}[0][value]", '', 'Widget is displayed'); } }