You are here

protected function ImportCommand::prepareConfigForImport in Tome 8

Prepares config for import by copying some directly from the source.

2 calls to ImportCommand::prepareConfigForImport()
ImportCommand::execute in modules/tome_sync/src/Commands/ImportCommand.php
ImportPartialCommand::execute in modules/tome_sync/src/Commands/ImportPartialCommand.php

File

modules/tome_sync/src/Commands/ImportCommand.php, line 141

Class

ImportCommand
Contains the tome:import command.

Namespace

Drupal\tome_sync\Commands

Code

protected function prepareConfigForImport() {

  /** @var \Drupal\Core\Config\StorageInterface $source_storage */
  $source_storage = \Drupal::service('config.storage.sync');
  if ($site_data = $source_storage
    ->read('system.site')) {
    \Drupal::configFactory()
      ->getEditable('system.site')
      ->setData($site_data)
      ->save(TRUE);
    if (!empty($site_data['default_langcode']) && ($language_data = $source_storage
      ->read('language.entity.' . $site_data['default_langcode']))) {
      \Drupal::configFactory()
        ->getEditable('language.entity.' . $site_data['default_langcode'])
        ->setData($language_data)
        ->save(TRUE);
    }
  }
}