You are here

private function AmpSettingsForm::getThemeOptions in Accelerated Mobile Pages (AMP) 8

Same name and namespace in other branches
  1. 8.3 src/Form/AmpSettingsForm.php \Drupal\amp\Form\AmpSettingsForm::getThemeOptions()
  2. 8.2 src/Form/AmpSettingsForm.php \Drupal\amp\Form\AmpSettingsForm::getThemeOptions()
1 call to AmpSettingsForm::getThemeOptions()
AmpSettingsForm::__construct in src/Form/AmpSettingsForm.php
Constructs a AmpSettingsForm object.

File

src/Form/AmpSettingsForm.php, line 67

Class

AmpSettingsForm
Defines the configuration export form.

Namespace

Drupal\amp\Form

Code

private function getThemeOptions() {

  // Get all available themes.
  $themes = $this->themeHandler
    ->rebuildThemeData();
  uasort($themes, 'system_sort_modules_by_info_name');
  $theme_options = [];
  foreach ($themes as $theme) {
    if (!empty($theme->info['hidden'])) {
      continue;
    }
    else {
      if (!empty($theme->status) && !empty($theme->base_themes) && (array_key_exists('amptheme', $theme->base_themes) || $theme->info['name'] == 'AMP Base')) {
        $theme_options[$theme
          ->getName()] = $theme->info['name'];
      }
    }
  }
  return $theme_options;
}