We had a custom block injected in the adminhtml section. This block is managed in a module (let's call it Vendor/Module) & it was working fine in Magento 2.1.*, following this methodology magento 2 - How to create a custom "admin" block and display it on an existing Admin page?
After upgrading to 2.2 the block has disappeared
I have checked for the concrete layout (in our case sales_order_view.xml) for any structural changes in the new version, but containers & blocks look the same as we had in 2.1.*
Any ideas for this?
This is the concrete layout file which worked fine in 2.1.*
app/code/Vendor/Module/view/adminhtml/layout/sales_order_view.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="order_info">
 <block class="Vendor\Module\Block\Adminhtml\Sales\Order\View\Form" name="our_unique_block_name" template="Vendor_Module::our_template.phtml"/>
 </referenceBlock>
 </body>
</page> 
UPDATE
Bounty: provide XML code to inject a block inside sales_order_view adminhtml layout, explaining how to place it in different sections of the page
3 Answers 3
Nero Phung answer was a good try, and led me to the real problem, looking for all sales_order_view appearances in the vendor folder
2.2 version adds Temando_Shipping module, which overrides sales_order_view layout
vendor/temando/module-shipping-m2/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>
 <referenceContainer name="order_tab_info">
 <block class="Temando\Shipping\Block\Adminhtml\Sales\Order\View\Info" name="order_info" template="Temando_Shipping::sales/order/view/info.phtml">
 <container name="extra_customer_info"/>
 </block>
 </referenceContainer>
 </body>
</page>
So I could recover our custom block (using same XML layout as the one we used in 2.1.*) just by adding a module dependency
<module name="Vendor_Module">
 <sequence>
 <module name="Temando_Shipping"/>
 </sequence>
</module>
- 
 1Congratulations!Nero Phung– Nero Phung2018年03月12日 16:39:29 +00:00Commented Mar 12, 2018 at 16:39
- 
 1Great work Raul, this saved me a lot of time debugging the same issue in our module on 2.2.Jake from TaxJar– Jake from TaxJar2018年04月20日 16:57:56 +00:00Commented Apr 20, 2018 at 16:57
As I can see. Magento has added a new container inside block named order_info:
<block class="Magento\Sales\Block\Adminhtml\Order\View\Info" name="order_info" template="Magento_Sales::order/view/info.phtml">
 <container name="extra_customer_info"/>
</block>
So you can try to use this code below:
<referenceContainer name="extra_customer_info">
 <block class="Vendor\Module\Block\Adminhtml\Sales\Order\View\Form" name="our_unique_block_name" template="Vendor_Module::our_template.phtml"/>
</referenceContainer>
Hope it will help!
- 
 I have noticed that layout change in 2.2, but I wasn't sure it should affect... anyways, I have tried changing to <referenceContainer name="extra_customer_info"> but block still doesn't appearRaul Sanchez– Raul Sanchez2018年03月12日 10:39:05 +00:00Commented Mar 12, 2018 at 10:39
- 
 magento.stackexchange.com/a/216961/3566Raul Sanchez– Raul Sanchez2018年03月12日 11:12:36 +00:00Commented Mar 12, 2018 at 11:12
Can you try with referenceContainer?
<?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>
 <referenceContainer name="order_info">
 <block class="Vendor\Module\Block\Adminhtml\Sales\Order\View\Form" name="our_unique_block_name" template="Vendor_Module::our_template.phtml"/>
 </referenceBlock>
 </body>
</page> 
- 
 What's the purpose of the change? Why using referenceContainer to reference a block?Raul Sanchez– Raul Sanchez2018年03月12日 10:36:35 +00:00Commented Mar 12, 2018 at 10:36
- 
 I use referenceBlock to modify block class (eg change template) and referenceContainer to include over blocks. And it work'sAurélien– Aurélien2018年03月12日 15:16:21 +00:00Commented Mar 12, 2018 at 15:16
- 
 But... I believe you cannot reference a block (using its name) with a referenceContainer instructionRaul Sanchez– Raul Sanchez2018年03月12日 16:27:18 +00:00Commented Mar 12, 2018 at 16:27
Explore related questions
See similar questions with these tags.