You are here

public function Language::prepareRow in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language::prepareRow()
  2. 9 core/modules/language/src/Plugin/migrate/source/Language.php \Drupal\language\Plugin\migrate\source\Language::prepareRow()

Adds additional data to the row.

Parameters

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

Return value

bool FALSE if this row needs to be skipped.

Overrides SourcePluginBase::prepareRow

File

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

Class

Language
Drupal 6/7 language source from database.

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);
}