cancel
Showing results for 
Search instead for 
Did you mean: 

Changing logo in admin theme

SOLVED

Changing logo in admin theme

I am trying to simple change the logo shown on the admin login page. After creating the following files i have run

magento setup:upgrade
magento setup:static-content:deploy -f
magento setup:di:compile
magento cache:clean

 

app/design/adminhtml/Myvendor/mycustomadmintheme/theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>My custom admin theme</title>
<parent>Magento/backend</parent>
</theme>

 

app/design/adminhtml/Myvendor/mycustomadmintheme/registration.php

<?php
 \Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'adminhtml/Myvendor/mycustomadmintheme',
__DIR__
);

 

app/design/adminhtml/Myvendor/mycustomadmintheme/Magento_Backend/layout/default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="logo">
            <arguments>
                <argument name="logo_file" xsi:type="string">images/mycustom_logo.png</argument>
                <argument name="logo_width" xsi:type="number">283</argument>
                <argument name="logo_height" xsi:type="number">85</argument>\
                <argument name="logo_alt" xsi:type="string">custom_logo</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

 

app/design/adminhtml/Myvendor/mycustomadmintheme/Magento_Backend/layout/admin_logo.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-login" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="logo">
            <arguments>
                <argument name="logo_image_src" xsi:type="string">images/mycustom_logo.png</argument>
                <argument name="logo_width" xsi:type="number">283</argument> <!-- Add custom logo width -->
                <argument name="logo_height" xsi:type="number">85</argument> <!-- Add custom logo height -->
            </arguments>
        </referenceBlock>
    </body>
 </page>

the di.xml file in etc folder of my working module is as follows:

<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="adminhtml" xsi:type="string">Myvendor/mycustomadmintheme</item>
             </argument>
         </arguments>
    </type>
</config>

despite all this the logo stays the same. however when i open the logo image in new tab, i can see that the magento logo is pulled from static/version1704465742/adminhtml/Myvendor/mycustomadmintheme/en_US/images/magento-logo.svg

 

So, the theme is working but the default.xml or admin_logo.xml is not. Can anyone tell me where i am going wrong, the magento version is 2.4

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Changing logo in admin theme

The filename should have been admin_login.xml. Resolved.

View solution in original post

1 REPLY 1

Re: Changing logo in admin theme

The filename should have been admin_login.xml. Resolved.