function VariableTranslation::values

Same name in this branch
  1. 10 core/modules/migrate_drupal/src/Plugin/migrate/source/d7/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d7\VariableTranslation::values()
Same name 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()
  2. 9 core/modules/migrate_drupal/src/Plugin/migrate/source/d7/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d7\VariableTranslation::values()
  3. 8.9.x core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d6\VariableTranslation::values()
  4. 8.9.x core/modules/migrate_drupal/src/Plugin/migrate/source/d7/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d7\VariableTranslation::values()
  5. 11.x core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d6\VariableTranslation::values()
  6. 11.x core/modules/migrate_drupal/src/Plugin/migrate/source/d7/VariableTranslation.php \Drupal\migrate_drupal\Plugin\migrate\source\d7\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 71

Class

VariableTranslation
Drupal 6 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;
}

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