Same name and namespace in other branches
- 8.9.x core/modules/language/src/Plugin/migrate/destination/DefaultLangcode.php \Drupal\language\Plugin\migrate\destination\DefaultLangcode
- 9 core/modules/language/src/Plugin/migrate/destination/DefaultLangcode.php \Drupal\language\Plugin\migrate\destination\DefaultLangcode
Hierarchy
- class \Drupal\language\Plugin\migrate\destination\DefaultLangcode extends \Drupal\migrate\Plugin\migrate\destination\Config
Expanded class hierarchy of DefaultLangcode
File
- core/
modules/ language/ src/ Plugin/ migrate/ destination/ DefaultLangcode.php, line 15
Namespace
Drupal\language\Plugin\migrate\destinationView source
class DefaultLangcode extends Config {
/**
* {@inheritdoc}
*/
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(),
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultLangcode:: |
public | function |