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\Backend\Block\Widget\Context"> <plugin name="add_custom_button_sales_veiw" type="MyModule\RK\Plugin\Widget\Context" sortOrder="1"/> </type> </config>
Context.php
<?php namespace MyModule\RK\Plugin\Widget; class Context { public function afterGetButtonList( \Magento\Backend\Block\Widget\Context $subject, $buttonList ) { if($subject->getRequest()->getFullActionName() == 'sales_order_view'){ $buttonList->add( 'custom_button', [ 'label' => 'test', 'onclick' => "setLocation('window.location.href')", 'class' => 'ship' ] ); } return $buttonList; } }
Review button is not displaying on order view page what i am doing wrong ??