function ThemeExtensionList::createExtensionInfo

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Extension/ThemeExtensionList.php \Drupal\Core\Extension\ThemeExtensionList::createExtensionInfo()
  2. 10 core/lib/Drupal/Core/Extension/ThemeExtensionList.php \Drupal\Core\Extension\ThemeExtensionList::createExtensionInfo()
  3. 11.x core/lib/Drupal/Core/Extension/ThemeExtensionList.php \Drupal\Core\Extension\ThemeExtensionList::createExtensionInfo()

Overrides ExtensionList::createExtensionInfo

File

core/lib/Drupal/Core/Extension/ThemeExtensionList.php, line 265

Class

ThemeExtensionList
Provides a list of available themes.

Namespace

Drupal\Core\Extension

Code

protected function createExtensionInfo(Extension $extension) {
    $info = parent::createExtensionInfo($extension);
    if (!isset($info['base theme'])) {
        throw new InfoParserException(sprintf('Missing required key ("base theme") in %s, see https://www.drupal.org/node/3066038', $extension->getPathname()));
    }
    // Remove the base theme when 'base theme: false' is set in a theme
    // .info.yml file.
    if ($info['base theme'] === FALSE) {
        unset($info['base theme']);
    }
    if (!empty($info['base theme'])) {
        // Add the base theme as a proper dependency.
        $info['dependencies'][] = $info['base theme'];
    }
    // Prefix screenshot with theme path.
    if (!empty($info['screenshot'])) {
        $info['screenshot'] = $extension->getPath() . '/' . $info['screenshot'];
    }
    return $info;
}

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