0

Is it is possible to create base theme, which will become a common theme to both the adminhtml and frontend?

3

I would say this is not feasible since you have the registration.php where you are declaring your theme component by initially mentioning the area it is dedicated to.

For backend you have:

use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/%vendor_dir/your_theme_dir%', __DIR__);

For frontend you have:

use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/<Vendor>/<theme>', __DIR__);

So basically, you can't have the same theme as a single component declared on 2 areas in the same time due to the registration.php file instructions.


Some sidenotes:

Let's take the example of the backend (adminhtml) - assuming you don't want to write everything from scratch, you will have to rely on the Magento default backend theme and your custom theme will have to mention the inheritance in the theme.xml file with the <parent>Magento/backend</parent> property. If you want to also start from Magento_Blank or Luma for frontend, you will have to inherit one of them also, so again, you won't be able to inherit 2 themes in the same time due to the tehme inheritance mechanism in Magento.

In addition, in the admin -> Content -> Design -> Themes you get a filtered list of the frontend themes only. A list that is retrieved by a resource model specifically filters the list of themes assigned to the frontend area based on the registration.php file. Once again, you can't assign both frontend and backend here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.