You are here

public function ThemeSettings::import in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php \Drupal\system\Plugin\migrate\destination\d7\ThemeSettings::import()

Import the row.

Derived classes must implement import(), to construct one new object (pre-populated) using ID mappings in the Migration.

Parameters

\Drupal\migrate\Row $row: The row object.

array $old_destination_id_values: (optional) The old destination IDs. Defaults to an empty array.

Return value

array|bool An indexed array of destination IDs in the same order as defined in the plugin's getIds() method if the plugin wants to save the IDs to the ID map, TRUE to indicate success without saving IDs to the ID map, or FALSE to indicate a failure.

Overrides MigrateDestinationInterface::import

File

core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php, line 63

Class

ThemeSettings
Persist theme settings to the config system.

Namespace

Drupal\system\Plugin\migrate\destination\d7

Code

public function import(Row $row, array $old_destination_id_values = []) {
  $imported = FALSE;
  $config = $this->configFactory
    ->getEditable($row
    ->getDestinationProperty('configuration_name'));
  $theme_settings = $row
    ->getDestination();

  // Remove keys not in theme settings.
  unset($theme_settings['configuration_name']);
  unset($theme_settings['theme_name']);
  if (isset($theme_settings)) {
    theme_settings_convert_to_config($theme_settings, $config);
    $config
      ->save();
    $imported = TRUE;
  }
  return $imported;
}