ThemeInfo.php in AT Tools 8.2
File
at_theme_generator/src/Theme/ThemeInfo.php
View source
<?php
namespace Drupal\at_theme_generator\Theme;
class ThemeInfo {
public function __construct() {
$this->data = \Drupal::service('theme_handler')
->rebuildThemeData();
}
public function themeOptions($subtheme_type) {
$base_themes = [];
foreach ($this->data as $machine_name => $theme) {
foreach ($theme as $theme_key => $theme_values) {
if ($theme_key === 'info') {
if (isset($theme_values['subtheme type']) && $theme_values['subtheme type'] === $subtheme_type) {
$base_themes[$machine_name] = $machine_name;
}
}
}
}
unset($base_themes['at_standard']);
unset($base_themes['at_minimal']);
unset($base_themes['at_skin']);
unset($base_themes['at_starterkit']);
unset($base_themes['at_generator']);
unset($base_themes['THEMENAME']);
unset($base_themes['STARTERKIT']);
unset($base_themes['SKIN']);
return $base_themes;
}
public function themeNameExists($machine_name) {
$result = FALSE;
if (array_key_exists($machine_name, $this->data)) {
$result = TRUE;
}
return $result;
}
}
Classes
Name |
Description |
ThemeInfo |
ThemeSettingsInfo declares methods used to return theme info for use in
theme-settings.php. Note the constructor calls system_rebuild_theme_data()
which is not statically cached therefor only used in the backend, however
it always returns fresh data. |