You are here

protected function Configuration::printRaw in Configuration Management 7.2

Print the configuration as plain text formatted to use in a tar file.

Parameters

ConfigIteratorSettings $settings:

See also

iterate()

File

lib/Drupal/configuration/Config/Configuration.php, line 808
Definition of Drupal\configuration\Config\Configuration.

Class

Configuration

Namespace

Drupal\configuration\Config

Code

protected function printRaw(ConfigIteratorSettings &$settings) {
  $this
    ->build();
  $this
    ->buildHash();
  $settings
    ->addInfo('hash', $this
    ->getHash());
  $file_name = $this->storage
    ->getFileName();
  $settings
    ->addInfo('exported', $this
    ->getUniqueId());
  foreach ($this
    ->getRequiredModules() as $module => $status) {
    $settings
      ->addInfo('modules', $module);
  }
  $settings
    ->addInfo('exported_files', $file_name);
  if ($settings
    ->getSetting('format') == 'tar') {
    $file_content = $this
      ->raw();
    print ConfigurationManagement::createTarContent($settings
      ->getSetting('tar_folder') . "/{$file_name}", $file_content);
  }
  else {
    $print = $settings
      ->getSetting('print');
    if (is_array($print)) {
      if (!empty($print['dependencies'])) {
        foreach (array_keys($this
          ->getDependencies()) as $line) {
          print '  "' . $line . '": "' . $line . "\",\n";
        }
      }
      if (!empty($print['optionals'])) {
        foreach (array_keys($this
          ->getOptionalConfigurations()) as $line) {
          print '  "' . $line . '": "' . $line . "\",\n";
        }
      }
    }
  }
}