You are here

public function ThemeGenerator::renameConfigFiles in AT Tools 8.3

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

Rename config files.

2 calls to ThemeGenerator::renameConfigFiles()
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 222

Class

ThemeGenerator
Generator form.

Namespace

Drupal\at_theme_generator\Theme

Code

public function renameConfigFiles() {
  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
            ->fileRename($target_config_path . '/' . $config_file, $target_config_path . '/' . $new_config_file);
        }
      }
    }
  }
}