Skip to content

Instantly share code, notes, and snippets.

@vasilii-b
Created February 14, 2021 12:04
Show Gist options
  • Save vasilii-b/3e51f0fe5c3ca395ff73b4ceea8f5cde to your computer and use it in GitHub Desktop.
Save vasilii-b/3e51f0fe5c3ca395ff73b4ceea8f5cde to your computer and use it in GitHub Desktop.
Magento 2 - Enable theme from codebase.
<?php
// Project's config.php file
return [
'system'=> [
'default' =>[
'design' => [
'theme' => [
'theme_id' => 'frontend/vendor/theme-name', // theme name, as declared in registration.php
]
]
]
],
]
<?php
// theme's registration.php file
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/vendor/theme-name', __DIR__);
@vasilii-b
Copy link
Author

⚠️ doesn't quite work when there is a theme set via admin panel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment