Modify the default admin logo in Magento 2 (login portal and backend menu)
In order to change top left logo of the admin menu you have to create in your custom module view/adminhtml/layout/default.xml
file:
<?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>
<referenceContainer name="header">
<block class="Magento\Backend\Block\Page\Header" name="logo" before="-">
<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">images/custom-admin-icon.svg</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
Place custom-admin-icon.svg
with height 25px and width 41px into CustomModule/view/web/images/custom-admin-icon.svg
For the Admin Login page create new view/adminhtml/layout/admin_login.xml
file:
<?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">images/custom-admin-logo.svg</argument>
</arguments>
</referenceBlock>
</body>
Feel free to use PNG files instead of SVG.
There are 2 small changes in 'Max Pronko' module:
1) Add Namespace_Modulename
before image path
<?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">Namespace_Modulename/images/custom-admin-logo.svg</argument>
</arguments>
</referenceBlock>
</body>
2) And change directory: CustomModule/view/web/images/custom-admin-icon.svg
to
CustomModule/view/adminhtml/web/images/custom-admin-icon.svg