function Language::prepareRow

Same name in other branches
  1. 9 core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language::prepareRow()
  2. 10 core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language::prepareRow()
  3. 11.x core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language::prepareRow()

Overrides SourcePluginBase::prepareRow

File

core/modules/language/src/Plugin/migrate/source/Language.php, line 56

Class

Language
Plugin annotation @MigrateSource( id = "language", source_module = "locale" )

Namespace

Drupal\language\Plugin\migrate\source

Code

public function prepareRow(Row $row) {
    if (!empty($this->configuration['fetch_all'])) {
        // Get an array of all languages.
        $languages = $this->query()
            ->execute()
            ->fetchAll();
        $row->setSourceProperty('languages', $languages);
    }
    if (!empty($this->configuration['domain_negotiation'])) {
        // Check if domain negotiation is used to be able to fill in the default
        // language domain, which may be empty. In D6, domain negotiation is used
        // when the 'language_negotiation' variable is set to '3', and in D7, when
        // the 'locale_language_negotiation_url_part' variable is set to '1'.
        if ($this->variableGet('language_negotiation', 0) == 3 || $this->variableGet('locale_language_negotiation_url_part', 0) == 1) {
            $row->setSourceProperty('domain_negotiation_used', TRUE);
        }
    }
    return parent::prepareRow($row);
}

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