function DefaultLangcode::import
Same name in other branches
- 8.9.x core/modules/language/src/Plugin/migrate/destination/DefaultLangcode.php \Drupal\language\Plugin\migrate\destination\DefaultLangcode::import()
- 10 core/modules/language/src/Plugin/migrate/destination/DefaultLangcode.php \Drupal\language\Plugin\migrate\destination\DefaultLangcode::import()
- 11.x core/modules/language/src/Plugin/migrate/destination/DefaultLangcode.php \Drupal\language\Plugin\migrate\destination\DefaultLangcode::import()
Overrides Config::import
File
-
core/
modules/ language/ src/ Plugin/ migrate/ destination/ DefaultLangcode.php, line 22
Class
- DefaultLangcode
- Provides a destination plugin for the default langcode config.
Namespace
Drupal\language\Plugin\migrate\destinationCode
public function import(Row $row, array $old_destination_id_values = []) {
$destination = $row->getDestination();
$langcode = $destination['default_langcode'];
// Check if the language exists.
if (ConfigurableLanguage::load($langcode) === NULL) {
throw new MigrateException("The language '{$langcode}' does not exist on this site.");
}
$this->config
->set('default_langcode', $destination['default_langcode']);
$this->config
->save();
return [
$this->config
->getName(),
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.