You are here

public function ThemeGenerator::rewriteConfigFiles in AT Tools 8.2

Same name and namespace in other branches
  1. 8.3 at_theme_generator/src/Theme/ThemeGenerator.php \Drupal\at_theme_generator\Theme\ThemeGenerator::rewriteConfigFiles()

Rewrite config files.

2 calls to ThemeGenerator::rewriteConfigFiles()
ThemeGeneratorTypes::cloneGenerator in at_theme_generator/src/Theme/ThemeGeneratorTypes.php
Generate clone type theme.
ThemeGeneratorTypes::starterkitGenerator in at_theme_generator/src/Theme/ThemeGeneratorTypes.php
Generate starter kit type theme.

File

at_theme_generator/src/Theme/ThemeGenerator.php, line 244

Class

ThemeGenerator
Generator form.

Namespace

Drupal\at_theme_generator\Theme

Code

public function rewriteConfigFiles() {
  if (!empty($this->config)) {
    foreach ($this->config as $config_path => $config_files) {
      $dir = $this->target . '/config/' . $config_path;
      if (is_dir($dir)) {
        foreach ($config_files as $config_file) {
          $new_config_file = str_replace($this->source['name'], $this->machine_name, $config_file) ?: '';
          $target_config_path = $this->target . '/config/' . $config_path;
          $this->fileOperations
            ->fileStrReplace($target_config_path . '/' . $new_config_file, 'TARGET', $this->target);
          $this->fileOperations
            ->fileStrReplace($target_config_path . '/' . $new_config_file, $this->source['name'], $this->machine_name);
        }
      }
    }
  }
}