class ThemeGeneratorTypes in AT Tools 8.3
Same name and namespace in other branches
- 8.2 at_theme_generator/src/Theme/ThemeGeneratorTypes.php \Drupal\at_theme_generator\Theme\ThemeGeneratorTypes
Generate themes by type.
Hierarchy
- class \Drupal\at_theme_generator\Theme\ThemeGenerator
- class \Drupal\at_theme_generator\Theme\ThemeGeneratorTypes
Expanded class hierarchy of ThemeGeneratorTypes
1 file declares its use of ThemeGeneratorTypes
- GeneratorForm.php in at_theme_generator/
src/ Form/ GeneratorForm.php
File
- at_theme_generator/
src/ Theme/ ThemeGeneratorTypes.php, line 8
Namespace
Drupal\at_theme_generator\ThemeView source
class ThemeGeneratorTypes extends ThemeGenerator {
/**
* Generate starter kit type theme.
*/
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);
}
/**
* Generate clone type theme.
*/
public function cloneGenerator() {
// Copy source.
$this
->copySource();
// Yml files.
$yml_files = [
'shortcodes',
'libraries',
'info',
];
$this
->renameYmlFiles($yml_files);
if ($this->info['subtheme type'] === 'adaptive_subtheme') {
// [theme_name].theme.
$this
->renameThemeFile();
$this
->rewriteThemeFile($this->source['name']);
// theme-settings.php
$this
->rewriteThemeSettingsFile($this->source['name']);
// Config.
$this
->renameConfigFiles();
$this
->rewriteConfigFiles();
$this
->replaceCloneConfigSettings();
// Generated CSS files.
$this
->renameGeneratedCssFiles();
// Templates.
$this
->rewritePageTemplateLibrary();
}
else {
// Stylesheets and library.
$this
->processSkinStyles($this->source['name']);
}
$clone_quotes = [
'The shroud of the Dark Side has fallen. Begun, this clone war has.',
'Blind we are, if creation of this clone army we could not see.',
'The first step to correcting a mistake is patience.',
'A single chance is a galaxy of hope.',
'A very wise jedi once said nothing happens by accident.',
'Smaller in number we are but larger in mind.',
];
$cq = array_rand($clone_quotes);
$clone_quote = $clone_quotes[$cq];
// Description
if (!empty($this->description)) {
$desc_text = $this->description;
}
else {
$desc_text = '<em>' . $clone_quote . '</em>';
}
$desc['text'] = $desc_text;
$desc['base'] = $this->info['base theme'] . ' (' . $this->info['base theme original'] . ')';
$desc['time'] = $this->datetime;
$desc['clone'] = $this->source['name'];
// Info
$info['name'] = "{$this->friendly_name}";
$info['version'] = $this->version;
$info['type'] = "theme";
$info['base theme'] = $this->info['base theme'];
$info['base theme original'] = $this->info['base theme original'];
$info['subtheme type'] = $this->info['subtheme type'];
$info['layout'] = $this->info['layout'];
$info['description'] = $this
->infoYmlDescription($desc);
$info['core'] = '8.x';
$info['regions'] = $this->info['regions'];
// Tags.
if (isset($this->info['tags']) && !empty($this->info['tags'])) {
$info['tags'] = $this->info['tags'];
}
// Libraries.
if (isset($this->info['libraries']) && !empty($this->info['libraries'])) {
$info['libraries'] = $this->info['libraries'];
}
// Libraries extend.
if (isset($this->info['libraries-extend']) && !empty($this->info['libraries-extend'])) {
$info['libraries-extend'] = $this->info['libraries-extend'];
if (isset($info['libraries-extend']['quickedit/quickedit'])) {
$info['libraries-extend']['quickedit/quickedit'] = [
$this->machine_name . '/quickedit',
];
}
}
// Stylesheets remove.
if (isset($this->info['stylesheets-remove']) && !empty($this->info['stylesheets-remove'])) {
$info['stylesheets-remove'] = $this->info['stylesheets-remove'];
}
// Features.
if (isset($this->info['features']) && !empty($this->info['features'])) {
$info['features'] = $this->info['features'];
}
$this
->infoYml($info);
}
/**
* Generate skin type theme.
*/
public function skinGenerator() {
// Copy source.
$this
->copySource();
// Yml files.
$yml_files = [
'libraries',
'info',
];
$this
->renameYmlFiles($yml_files);
// Stylesheets and library.
$this
->processSkinStyles('SKIN');
// Remove SCSS if base theme does not support it.
$skin_base_path = drupal_get_path('theme', $this->skin_base);
if (!file_exists($skin_base_path . '/Gruntfile.js')) {
$this
->removeScss();
$this
->removeScssTools();
}
// Logos
$this
->replaceSkinLogos();
// Description
$desc['text'] = $this->description;
$desc['base'] = $this->skin_base . ' (' . $this->base_theme_info['base theme original'] . ')';
$desc['time'] = $this->datetime;
$desc['skin'] = $this->skin_base;
// Info
$info['name'] = "{$this->friendly_name}";
$info['version'] = $this->version;
$info['type'] = "theme";
$info['base theme'] = $this->skin_base;
$info['base theme original'] = $this->base_theme_info['base theme original'];
$info['subtheme type'] = 'adaptive_skin';
$info['layout'] = $this->base_theme_info['layout'];
$info['description'] = $this
->infoYmlDescription($desc);
$info['core'] = '8.x';
$info['regions'] = $this->base_theme_info['regions'];
$info['tags'] = 'adaptivetheme sub-theme';
$info['features'] = $this->info['features'];
$info['libraries'] = [
$this->machine_name . '/skin',
];
$this
->infoYml($info);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | Protected variables. | |
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
protected | property | ||
ThemeGenerator:: |
public | function | Copy the source theme to the target location. | |
ThemeGenerator:: |
public | function | Copy base theme templates. | |
ThemeGenerator:: |
public | function | Return the base themes info yml. | |
ThemeGenerator:: |
public | function | Get the clone source themes config from the active configuration. | |
ThemeGenerator:: |
public | function | Return this themes component CSS files. | |
ThemeGenerator:: |
public | function | Return this themes source configuration files. We need to get the source themes config because the target copy may not yet exist. | |
ThemeGenerator:: |
public | function | Return this themes generated CSS files. | |
ThemeGenerator:: |
public | function | Return the source themes info yml. We need to parse the source themes info yml because the target copy may not yet exist. | |
ThemeGenerator:: |
public | function | Get layout. | |
ThemeGenerator:: |
public | function | ||
ThemeGenerator:: |
public | function | Format theme description. | |
ThemeGenerator:: |
public | function | Rename Skin styles & library declarations. | |
ThemeGenerator:: |
public | function | Remove the color directory. | |
ThemeGenerator:: |
public | function | Remove config files. | |
ThemeGenerator:: |
public | function | Remove CSS source mapping URLs in CSS files. | |
ThemeGenerator:: |
public | function | Remove CSS source map files. | |
ThemeGenerator:: |
public | function | Remove SCSS/SASS related directories and files. | |
ThemeGenerator:: |
public | function | Remove SCSS tools and related files. | |
ThemeGenerator:: |
public | function | Remove the theme-settings.php file. | |
ThemeGenerator:: |
public | function | Remove unused layout directory and files. | |
ThemeGenerator:: |
public | function | Rename config files. | |
ThemeGenerator:: |
public | function | Rename this themes generated CSS files. | |
ThemeGenerator:: |
public | function | Rename layouts. | |
ThemeGenerator:: |
public | function | Rename the [theme_name].theme file. | |
ThemeGenerator:: |
public | function | Rename .yml files. | |
ThemeGenerator:: |
public | function | Replace the installation config with the clone sources active config. | |
ThemeGenerator:: |
public | function | Copy logos from the skin source/base to the skin theme. | |
ThemeGenerator:: |
public | function | Rewrite config files. | |
ThemeGenerator:: |
public | function | Rewrite library versions in [theme_name].libraries.yml. | |
ThemeGenerator:: |
public | function | Rewrite the generated layout CSS if it's a float based theme, and remove the float layout. | |
ThemeGenerator:: |
public | function | Rewrite Page Template Library. | |
ThemeGenerator:: |
public | function | Rewrite the [theme_name].theme file to replace stings. | |
ThemeGenerator:: |
public | function | Rewrite the theme-settings.php file to replace stings. | |
ThemeGenerator:: |
public | function | Rewrite page layout include. | |
ThemeGenerator:: |
public | function | Return the source theme name to use in string operations and the path to the source theme. | |
ThemeGenerator:: |
public | function | Path to where we will save the theme and perform generator operations. | |
ThemeGenerator:: |
public | function | Generator constructor. | |
ThemeGeneratorTypes:: |
public | function | Generate clone type theme. | |
ThemeGeneratorTypes:: |
public | function | Generate skin type theme. | |
ThemeGeneratorTypes:: |
public | function | Generate starter kit type theme. |