protected function ThemeExtensionList::createExtensionInfo in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Extension/ThemeExtensionList.php \Drupal\Core\Extension\ThemeExtensionList::createExtensionInfo()
- 9 core/lib/Drupal/Core/Extension/ThemeExtensionList.php \Drupal\Core\Extension\ThemeExtensionList::createExtensionInfo()
Creates the info value for an extension object.
Parameters
\Drupal\Core\Extension\Extension $extension: The extension whose info is to be altered.
Return value
array The extension info array.
Overrides ExtensionList::createExtensionInfo
File
- core/
lib/ Drupal/ Core/ Extension/ ThemeExtensionList.php, line 265
Class
- ThemeExtensionList
- Provides a list of available themes.
Namespace
Drupal\Core\ExtensionCode
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;
}