0

I want to call one custom phtml file after Customer Edit Account Information Form.

Currently, I have tried below way so phtml file called but it's display on every customer edit tab?

  1. Vendor/Extension/view/adminhtml/layout/customer_index_edit.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="content">
            <block class="Vendor\Extension\Block\Adminhtml\Customer\View\Custom"
                   name="customer_edit_tab_view_custom"
                   template="Vendor_Extension::customer/view/custom.phtml">
            </block>
        </referenceBlock>
    </body>
</page>
  1. Vendor/Extension/view/adminhtml/templates/customer/view/custom.phtml
<div>Testdata</div>
 
  1. Vendor/Extension/Block/Adminhtml/Customer/View/Custom.php
<?php
namespace Magecomp\Googlemaplocation\Block\Adminhtml\Customer\View;

class Custom extends \Magento\Customer\Block\Adminhtml\Edit\Tab\View
{
    /**
     * @return \Magento\Framework\Phrase
     */
    public function getTabLabel()
    {
        return __('Custom Label');
    }

    /**
     * @return \Magento\Framework\Phrase
     */
    public function getTabTitle()
    {
        return __('Custom Label');
    }
}

Now, Testdata display after every Customer Edit tab content I want to display Testdata only after Account Information form.

How to do this ?

1
  • you want to add a field in the account information tab last.? Mar 21 at 11:06

1 Answer 1

1

You need to following things.

  1. Vendor/Extension/view/base/ui_component/customer_form.xml

Add code like this.

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
   <fieldset name="customer">
        <htmlContent name="html_content">
             <argument name="block" xsi:type="object">Vendor\Extension\Block\Adminhtml\Customer\View\Custom</argument>
         </htmlContent>
   </fieldset>
</form>

And into block file added code like this :

<?php
namespace Vendor\Extension\Block\Adminhtml\Customer\View;
 
class Custom extends \Magento\Backend\Block\Template
{
    protected $_template = 'customer\view\custom.phtml';
}
1
  • i will add code but not working all tabs show testdata Mar 21 at 11:36

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.