How and what to add to be able to override any of the magento-backend module templates and what is the sequence order of the custom module or theme
2 Answers
I followed this solution https://magento.stackexchange.com/a/96559/23344 and it works like a charm.
Below its step 3 improved.
I created the module in \app\code\XXX\Backend\
and within the files:
\app\code\XXX\Backend\registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE, 'XXX_Backend', __DIR__
);
\app\code\XXX\Backend\etc\module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="XXX_Backend" setup_version="1.0.0">
<sequence>
<module name="Magento_Backend"/>
</sequence>
</module>
</config>
\app\code\XXX\Backend\etc\di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Theme\Model\View\Design">
<arguments>
<argument name="themes" xsi:type="array">
<item name="frontend" xsi:type="string">Magento/luma</item>
<item name="adminhtml" xsi:type="string">XXX/backend</item>
</argument>
</arguments>
</type>
</config>
Finally run php bin/magento setup:upgrade
Now you could extend adminhtml template, i customize \app\design\adminhtml\XXX\backend\Magento_Sales\templates\items\column\name.phtml
and it works.
-
I applied this solution and it works but products thumbnails is no longer visible Commented Jun 21, 2016 at 7:50
-
-
2What you wrote works great in sense that it is applied, but my custom theme for admin has no generated files. I'm missing files from
/pub/static
after runningsetup:upgrade
andsetup:static-content:deploy
. What am I missing here ? Commented Aug 6, 2016 at 8:49 -
-
was anyone able to create an adminhtml theme following the M2 docs?– dchaykaCommented Aug 22, 2017 at 15:30
A follow-up to Luca's answer that might help others like who only look to extend the layout:
- in your newly created app that sets the adminhtml theme, in etc/module.xml, you have use:
<module name="Magento_Theme"/>
as a sequence.
- you have to have some css file or other static content in app/design/adminhtml/name/theme/web
(I placed the _theme.less file in /web/css/source)
. You can inspect the checkThemesInput method inMagento\Deploy\Console\Command\DeployStaticContentCommand
to find out why.
-
1+1 for your second point. I was missing this and it will not work without at least something in there. After this you need to do setup:deploy Commented Sep 28, 2016 at 17:57
-
For those who want to know how to override adminthml colors and CSS. magento.stackexchange.com/questions/121116/…– camdixonCommented Apr 2, 2018 at 15:38
-
I have made composer installable base admin theme for Magento 2.2.2 as I did not see any composer examples out there. This question & answer was of great help! github.com/camdixon/magento2-admin-theme– camdixonCommented Apr 2, 2018 at 23:25