class DefaultLangcode

Same name and namespace in other branches
  1. 11.x core/modules/language/src/Plugin/migrate/destination/DefaultLangcode.php \Drupal\language\Plugin\migrate\destination\DefaultLangcode

Provides a destination plugin for the default langcode config.

Plugin annotation


@MigrateDestination(
  id = "default_langcode"
)

Hierarchy

Expanded class hierarchy of DefaultLangcode

1 string reference to 'DefaultLangcode'
ContentEntityCloneTest::testEntityPropertiesModifications in core/tests/Drupal/KernelTests/Core/Entity/ContentEntityCloneTest.php
Tests references of entity properties after entity cloning.

File

core/modules/language/src/Plugin/migrate/destination/DefaultLangcode.php, line 17

Namespace

Drupal\language\Plugin\migrate\destination
View 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

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
Config::$config protected property The config object.
Config::$language_manager protected property The language manager.
Config::calculateDependencies public function
Config::create public static function
Config::fields public function
Config::getDestinationModule public function
Config::getIds public function
Config::isTranslationDestination protected function Get whether this destination is for translations.
Config::rollback public function
Config::__construct public function Constructs a Config destination object.
DefaultLangcode::import public function Import the row. Overrides Config::import
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function
DependencySerializationTrait::__wakeup public function #[\ReturnTypeWillChange]
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency.
DestinationBase::$migration protected property The migration.
DestinationBase::$rollbackAction protected property The rollback action to be saved for the last imported item.
DestinationBase::$supportsRollback protected property Indicates whether the destination can be rolled back.
DestinationBase::checkRequirements public function
DestinationBase::rollbackAction public function
DestinationBase::setRollbackAction protected function For a destination item being updated, set the appropriate rollback action.
DestinationBase::supportsRollback public function
MessengerTrait::$messenger protected property The messenger. 7
MessengerTrait::$messenger protected property The messenger. 7
MessengerTrait::messenger public function Gets the messenger. 7
MessengerTrait::messenger public function Gets the messenger. 7
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin.
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function
PluginBase::getDerivativeId public function
PluginBase::getPluginDefinition public function 1
PluginBase::getPluginDefinition public function 1
PluginBase::getPluginId public function
PluginBase::isConfigurable public function Determines if the plugin is configurable.
StringTranslationTrait::$stringTranslation protected property The string translation service.
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use.
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.