init
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\VatInvoice\Plugin\Adminhtml;
|
||||
|
||||
use Magento\Backend\Model\UrlInterface;
|
||||
use Magento\Framework\View\LayoutInterface;
|
||||
use Magento\Sales\Block\Adminhtml\Order\Invoice\View;
|
||||
|
||||
class InvoiceViewButton
|
||||
{
|
||||
public function __construct(private readonly UrlInterface $url)
|
||||
{
|
||||
}
|
||||
|
||||
public function beforeSetLayout(View $subject, LayoutInterface $layout): array
|
||||
{
|
||||
$invoice = $subject->getInvoice();
|
||||
if ($invoice && $invoice->getId()) {
|
||||
$url = $this->url->getUrl(
|
||||
'esun_vatinvoice/invoice/printAction',
|
||||
['invoice_id' => (int)$invoice->getId()]
|
||||
);
|
||||
$subject->addButton('esun_vat_invoice', [
|
||||
'label' => __('Download VAT Invoice'),
|
||||
'class' => 'print',
|
||||
'onclick' => "setLocation('" . $url . "')",
|
||||
], 0, 95);
|
||||
}
|
||||
|
||||
return [$layout];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user