34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\MultiLocaleTranslation\Block\Adminhtml\Log;
|
|
|
|
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 API Log records? This action cannot be undone.');
|
|
$url = $this->context->getUrlBuilder()->getUrl('localetranslate/log/clearAll');
|
|
|
|
return [
|
|
'label' => __('Clear All Logs'),
|
|
'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::translation_log_delete',
|
|
];
|
|
}
|
|
}
|