Config.php

Same filename in this branch
  1. 8.9.x composer/Plugin/VendorHardening/Config.php
  2. 8.9.x core/modules/migrate/src/Plugin/migrate/destination/Config.php
  3. 8.9.x core/lib/Drupal/Core/Config/Config.php
Same filename and directory in other branches
  1. 10 composer/Plugin/VendorHardening/Config.php
  2. 10 core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php
  3. 11.x composer/Plugin/VendorHardening/Config.php
  4. 11.x core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php
  5. 11.x core/modules/migrate/src/Plugin/migrate/destination/Config.php
  6. 11.x core/lib/Drupal/Core/Config/Config.php
  7. 10 core/modules/migrate/src/Plugin/migrate/destination/Config.php
  8. 10 core/lib/Drupal/Core/Config/Config.php
  9. 9 composer/Plugin/VendorHardening/Config.php
  10. 9 core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php
  11. 9 core/modules/migrate/src/Plugin/migrate/destination/Config.php
  12. 9 core/lib/Drupal/Core/Config/Config.php

Namespace

Drupal\migrate_drupal\Plugin\migrate\source\d8

File

core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php

View source
<?php

namespace Drupal\migrate_drupal\Plugin\migrate\source\d8;

use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;

/**
 * Drupal config source from database.
 *
 * @MigrateSource(
 *   id = "d8_config",
 *   source_module = "system",
 * )
 */
class Config extends DrupalSqlBase {
  
  /**
   * {@inheritdoc}
   */
  public function query() {
    $query = $this->select('config', 'c')
      ->fields('c', [
      'collection',
      'name',
      'data',
    ]);
    if (!empty($this->configuration['collections'])) {
      $query->condition('collection', (array) $this->configuration['collections'], 'IN');
    }
    if (!empty($this->configuration['names'])) {
      $query->condition('name', (array) $this->configuration['names'], 'IN');
    }
    return $query;
  }
  
  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    $row->setSourceProperty('data', unserialize($row->getSourceProperty('data')));
  }
  
  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'collection' => $this->t('The config object collection.'),
      'name' => $this->t('The config object name.'),
      'data' => $this->t('Serialized configuration object data.'),
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getIds() {
    $ids['collection']['type'] = 'string';
    $ids['name']['type'] = 'string';
    return $ids;
  }

}

Classes

Title Deprecated Summary
Config Drupal config source from database.

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