Magento 2 Admin Logo Customization
Magento 2 Default Admin Logo and Copyright notice can be changed/modified for our custom needs. The Default Admin Logo is Rendered in Magento_Backend module. The logo image source is passed as an argument, we can replace the argument with our own image path.
For this Illustration I proceed directly to the solution approach skipping module creation step.
Custom logo Path
We need to place the custom logo in the below directory
Mydons/CustomAdminLogo/view/adminhtml/web/images
Override the admin login Layout
File:- Mydons\CustomAdminLogo\view\adminhtml\layout\admin_login.xml
Here i have replaced the “logo_image_src” argument value with the custom image path.
1 2 3 4 5 6 7 8 9 10 11 12 |
<?xml version="1.0"?> <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"> Mydons_CustomAdminLogo::images/customlogo.png </argument> </arguments> </referenceBlock> </body> </page> |
Replace the Magento 2 admin Icon
Once after logging in to the Magento 2 Admin Panel a Magento Icon will appear in the Menu Sidebar.
Let’s replace the Magento icon as well as the copyright notice under the footer using the below code snippet.
File: Mydons\CustomAdminLogo\view\adminhtml\layout\default.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="logo"> <arguments> <argument name="show_part" xsi:type="string">logo</argument> <argument name="edition" translate="true" xsi:type="string"> Community Edition </argument> <argument name="logo_image_src" xsi:type="string"> Mydons_CustomAdminLogo::images/customicon.png </argument> </arguments> </referenceBlock> <referenceBlock name="copyright"> <arguments> <argument name="template" xsi:type="string"> Mydons_CustomAdminLogo::copyright.phtml </argument> </arguments> </referenceBlock> </body> </page> |
Overriding the copyright template in admin
To Replace the copyright message we need to override the default adminhtml template.
File: Mydons\CustomAdminLogo\view\adminhtml\templates\copyright.phtml
1 |
<?= /* @escapeNotVerified */ __('Copyright © %1 CompanyName All rights reserved.', date('Y')) ?> |
Once the module is enabled we need to run the setup upgrade and Static Deployment command
1 2 |
php bin/magento setup:upgrade php -dmemory_limit=5G bin/magento setup:static-content:deploy -f |
Yes I did change the admin panel logo at dashboard and login. But there is another logo and some links in admin panel footer. How can I remove that ?