0

How to override adminhtml phtml files in magento2?

I want to place a custom text in customer edit page welcome to magento2. For this I have created a theme and placed

app\design\adminhtml\Vendor\backend\Magento_Customer\templates\tab\view.phtml

<h1>WELCOME TO MAGENTO2</h1>
<?php echo $block->getChildHtml(); ?>

but it's not working, when I place the same in app\code\Magento\Customer\view\adminhtml\templates\tab\view.phtml then it's working.

  • 1
    Do you enable custom theme for adminhtml aria? – KAndy Oct 15 '15 at 14:34
  • did you get that working? – Philipp Sander Apr 21 '16 at 14:06
  • @PhilippSander for adminhtml template files we have to create seperate theme for admin and edit template files same as front end module based structure – prasad maganti Apr 25 '16 at 9:15
  • thanks! already solved it myself with a different approach – Philipp Sander Apr 25 '16 at 13:17
  • 6
    If you have solved, you should share how you solved it. That's how a community works. – rbncha Jul 12 '16 at 17:39
1

adminhtml phtml file can be override as steps below

STEP 1: Add page layout XML in custom module.

app/code/[Vendor]/[Module]/view/adminhtml/layout/sales_order_view.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name='order_totals'>
      <action method="setTemplate">
        <argument name='template' translate="true" xsi:type='string'>[Vendor]_[Module]::order/totals.phtml</argument>
      </action>
    </referenceBlock>
</body>

STEP 2: Put template file on below path

app/code/[Vendor]/[Module]/view/adminhtml/templates/order/totals.phtml

Write custom code with existing content!!!

Hope ot will work for you :)

-3

I created a new module and copied the file to

app/code/[vendor]/[module]/view/adminhtml/templates/tab/view.phtml

it works.

  • This will not work. – Girish SH Aug 8 '18 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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