-1

i need to need to change admin copyright content they comes from this

vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml

so how can i override this in my app/design folder in magento 2?

enter image description here

1
  • you can override template in custom module Commented Aug 20, 2021 at 10:24

2 Answers 2

1

You will need to create an admin theme and register it. The solution applies to all common Magento 2 Admin customizations that can be done by just overriding a phtml template. You will just have to copy and place the template to customize at the right location (<theme_dir>/Magento_<MODULE>/templates/<template>.phtml.

Creating the admin theme

Create a admin theme directory under app/design/adminhtml/<Vendor>/<admin_theme_name>.

You will have to create a theme as documented in the Magento 2 DevDocs, if not already done. Registering the theme will need two files.

app/design/adminhtml/<Vendor>/<admin_theme_name>/registration.php:

<?php
use \Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(
    ComponentRegistrar::THEME, 
    'adminhtml/<Vendor>/<your_theme_name>', 
    __DIR__
);

app/design/adminhtml/<Vendor>/<admin_theme_name>/theme.xml:

<?xml version="1.0"?>
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Your Theme Name</title>
    <parent>Magento/backend</parent>
</theme>

Overridding the copyright.phtml

When you have created an admin theme, you can now override your template. To do that, copy the original file and place it at the correct position.

Copy vendor/magento/module-backend/view/adminhtml/templates/page/copyright.phtml to app/design/adminhtml/<Vendor>/<admin_theme_name>/Magento_Backend/templates/page/copyright.phtml. You can edit the template there to fit your needs (for example add some more text).

Applying the admin theme

You must register the admin theme in a module. Create a new module or use an existing one. The module must be loaded after the Magento_Theme module. You can find a reference for that in the Magento 2 DevDocs.

app/code/<Vendor>/<YourModule>/registration.php:

<?php declare(strict_types=1);

use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(
    ComponentRegistrar::MODULE,
    'Vendor_YourModule',
    __DIR__
);

app/code/<Vendor>/<YourModule>/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="Vendor_YourModule">
        <sequence>
            <module name="Magento_Theme"/>
        </sequence>
    </module>
</config>

Finally, after creating your module files, you have to register the theme in your di.xml:

app/code/<Vendor>/<YourModule>/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="adminhtml" xsi:type="string">Vendor/your_theme_name</item>
        </argument>
    </arguments>
</type>
</config>

You must now do a setup:upgrade. Replacing the copyright or another adminhtml template without creating a module that is applying your admin theme is not possible.

0

You need to create custom module for that :

Try following way:

Create default.xml at

app/code/Your_VendorName/Your_ModuleName/view/adminhtml/layout/default.xml

Add below code in 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="copyright">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Module::copyright.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Then Copy info.phtml file from

vendor/magento/module-theme/view/adminhtml/templates/html/copyright.phtml

To

app/code/Your_Vendor/Your_Module/view/adminhtml/templates/copyright.phtml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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