I created this button:
medienshop-dev/magento/app/code/UV/Bestellung/Plugin/Button.php
<?php
namespace UV\Bestellung\Plugin;
class Buttons
{
public function beforePushButtons(
\Magento\Backend\Block\Widget\Button\Toolbar\Interceptor $subject,
\Magento\Framework\View\Element\AbstractBlock $context,
\Magento\Backend\Block\Widget\Button\ButtonList $buttonList
) {
$this->_request = $context->getRequest();
if($this->_request->getFullActionName() == 'sales_order_view'){
#$url = $subject->getUrl('bestellschein/order/custom');
$url = "";
$buttonList->add(
'bestellschein',
['label' => __('Bestellschein'), 'onclick' => 'how to call PHP?', 'class' => 'reset'],
-1
);
}
}
}
?>
The button is working but I don't know how to call a controller when the button is clicked. It should print the package slip of an order.
I would like to call this one:
/magento/app/code/UV/Bestellung/Model/Order/Pdf/Shipment.php
Any suggestion how to do that? Thanks!