function GenerateTheme::getThemeInfo

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Command/GenerateTheme.php \Drupal\Core\Command\GenerateTheme::getThemeInfo()
  2. 11.x core/lib/Drupal/Core/Command/GenerateTheme.php \Drupal\Core\Command\GenerateTheme::getThemeInfo()

Gets theme info using the theme name.

Parameters

string $theme_name: The machine name of the theme.

Return value

\Drupal\Core\Extension\Extension|null

1 call to GenerateTheme::getThemeInfo()
GenerateTheme::execute in core/lib/Drupal/Core/Command/GenerateTheme.php

File

core/lib/Drupal/Core/Command/GenerateTheme.php, line 222

Class

GenerateTheme
Generates a new theme based on latest default markup.

Namespace

Drupal\Core\Command

Code

private function getThemeInfo(string $theme_name) : ?Extension {
    $extension_discovery = new ExtensionDiscovery($this->root, FALSE, []);
    $themes = $extension_discovery->scan('theme');
    $theme = $themes[$theme_name] ?? NULL;
    if ($theme !== NULL) {
        $theme->info = (new InfoParser($this->root))
            ->parse($theme->getPathname());
    }
    return $theme;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.