36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\MultiLocaleTranslation\Block\Adminhtml\Queue;
|
|
|
|
use Magento\Backend\Block\Widget\Context;
|
|
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
|
|
|
|
class ClearAllButton implements ButtonProviderInterface
|
|
{
|
|
public function __construct(private readonly Context $context)
|
|
{
|
|
}
|
|
|
|
public function getButtonData(): array
|
|
{
|
|
$message = __(
|
|
'Clear all translation queue records? Pending jobs will be removed. A job already being processed may still finish and write its translation.'
|
|
);
|
|
$url = $this->context->getUrlBuilder()->getUrl('localetranslate/queue/clearAll');
|
|
|
|
return [
|
|
'label' => __('Clear All Queue'),
|
|
'class' => 'delete',
|
|
'on_click' => 'deleteConfirm('
|
|
. json_encode((string)$message, JSON_HEX_APOS | JSON_HEX_QUOT)
|
|
. ', '
|
|
. json_encode($url, JSON_HEX_APOS | JSON_HEX_QUOT)
|
|
. ', {"data": {}})',
|
|
'sort_order' => 10,
|
|
'aclResource' => 'Esun_MultiLocaleTranslation::queue_delete',
|
|
];
|
|
}
|
|
}
|