You are here

public function ThemeGeneratorTypes::starterkitGenerator in AT Tools 8.3

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

Generate starter kit type theme.

File

at_theme_generator/src/Theme/ThemeGeneratorTypes.php, line 13

Class

ThemeGeneratorTypes
Generate themes by type.

Namespace

Drupal\at_theme_generator\Theme

Code

public function starterkitGenerator() {

  // Copy source.
  $this
    ->copySource();

  // Yml files.
  $yml_files = [
    'shortcodes',
    'libraries',
    'info',
  ];
  $this
    ->renameYmlFiles($yml_files);

  // Replace the version string in libraries.yml.
  $this
    ->rewriteLibrariesYml('VERSION_STRING');

  // [theme_name].theme.
  $this
    ->renameThemeFile();
  $this
    ->rewriteThemeFile('HOOK');

  // theme-settings.php
  if ($this->theme_settings_file === 0) {
    $this
      ->removeThemeSettingsFile();
  }
  else {
    $this
      ->rewriteThemeSettingsFile('HOOK');
  }

  // Config.
  $this
    ->renameConfigFiles();
  $this
    ->rewriteConfigFiles();
  if ($this->block_config === 0) {
    $this
      ->removeConfigFiles();
  }

  // Generated CSS files.
  $this
    ->rewritePageLayoutCSS();
  $this
    ->renameGeneratedCssFiles();

  // Templates.
  $this
    ->rewritePageTemplateLibrary();
  if ($this->templates === 1) {
    $this
      ->copyTemplates();
  }

  // Color.
  if ($this->color === 0) {
    $this
      ->removeColorDirectory();
  }

  // Remove/rename page layouts & layout_plugin.
  $this
    ->removeUnusedLayout();
  $this
    ->renameLayouts();
  $this
    ->rewriteUikitPartials();

  // Remove SCSS.
  if ($this->scss === 0) {
    $this
      ->removeCssSourceMaps();
    $this
      ->removeCssSourceMappingURL();
    $this
      ->removeScss();
    $this
      ->removeScssTools();
  }

  // Base theme original - version.
  $base_theme_original = isset($this->base_theme_info['version']) ? $this->base_theme_info['version'] : 'git-dev';

  // Description
  $desc['text'] = $this->description ?: '';
  $desc['base'] = 'at_core (' . $base_theme_original . ')';
  $desc['time'] = $this->datetime;

  // Info
  $info['name'] = "{$this->friendly_name}";
  $info['version'] = $this->version;
  $info['type'] = "theme";
  $info['base theme'] = 'at_core';
  $info['base theme original'] = $base_theme_original;
  $info['subtheme type'] = 'adaptive_subtheme';
  $info['layout'] = $this->layout_library;
  $info['description'] = $this
    ->infoYmlDescription($desc);
  $info['core'] = '8.x';
  $info['regions'] = $this->info['regions'];
  $info['tags'] = 'adaptivetheme sub-theme';
  $info['libraries-extend'] = [
    'quickedit/quickedit' => [
      $this->machine_name . '/quickedit',
    ],
  ];
  $info['stylesheets-remove'] = [
    '@stable/css/node/node.preview.css',
    '@stable/css/node/node.module.css',
    '@stable/css/views/views.module.css',
    '@stable/css/system/components/tablesort.module.css',
    '@classy/css/components/file.css',
  ];
  $info['features'] = [
    'logo',
    'favicon',
    'node_user_picture',
    'comment_user_picture',
    'comment_user_verification',
  ];
  $this
    ->infoYml($info);
}