You are here

protected function VariableTranslation::values in Drupal 8

Same name in this branch
  1. 8 core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d6\VariableTranslation::values()
  2. 8 core/modules/migrate_drupal/src/Plugin/migrate/source/d7/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d7\VariableTranslation::values()
Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d6\VariableTranslation::values()

Return the values of the variables specified in the plugin configuration.

Return value

array An associative array where the keys are the variables specified in the plugin configuration and the values are the values found in the source. A key/value pair is added for the language code. Only those values are returned that are actually in the database.

1 call to VariableTranslation::values()
VariableTranslation::initializeIterator in core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php
Initializes the iterator with the source data.

File

core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php, line 52

Class

VariableTranslation
Drupal i18n_variable source from database.

Namespace

Drupal\migrate_drupal\Plugin\migrate\source\d6

Code

protected function values() {
  $values = [];
  $result = $this
    ->prepareQuery()
    ->execute()
    ->FetchAllAssoc('language');
  foreach ($result as $i18n_variable) {
    $values[]['language'] = $i18n_variable->language;
  }
  $result = $this
    ->prepareQuery()
    ->execute()
    ->FetchAll();
  foreach ($result as $i18n_variable) {
    foreach ($values as $key => $value) {
      if ($values[$key]['language'] === $i18n_variable->language) {
        $values[$key][$i18n_variable->name] = unserialize($i18n_variable->value);
        break;
      }
    }
  }
  return $values;
}