67 lines
1.7 KiB
PHP
67 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\MultiLocaleTranslation\Block\Adminhtml\Queue;
|
|
|
|
use Esun\MultiLocaleTranslation\Model\ProviderConfig;
|
|
use Esun\MultiLocaleTranslation\Model\Queue\SelectionRegistry;
|
|
use Esun\MultiLocaleTranslation\Model\StoreViewProvider;
|
|
use Magento\Backend\Block\Template;
|
|
use Magento\Backend\Block\Template\Context;
|
|
use Magento\Framework\Data\Form\FormKey;
|
|
|
|
class Form extends Template
|
|
{
|
|
public function __construct(
|
|
Context $context,
|
|
private readonly StoreViewProvider $storeViewProvider,
|
|
private readonly ProviderConfig $providerConfig,
|
|
private readonly SelectionRegistry $selectionRegistry,
|
|
private readonly FormKey $formKeyService,
|
|
array $data = []
|
|
) {
|
|
parent::__construct($context, $data);
|
|
}
|
|
|
|
public function getSelection(): ?array
|
|
{
|
|
return $this->selectionRegistry->get($this->getToken());
|
|
}
|
|
|
|
public function getToken(): string
|
|
{
|
|
return (string)$this->getRequest()->getParam('token');
|
|
}
|
|
|
|
public function getStoreGroups(): array
|
|
{
|
|
return $this->storeViewProvider->getStoreViewGroups();
|
|
}
|
|
|
|
public function getProviders(): array
|
|
{
|
|
return $this->providerConfig->getEnabledOptions();
|
|
}
|
|
|
|
public function getDefaultProvider(): string
|
|
{
|
|
return $this->providerConfig->getDefaultProvider();
|
|
}
|
|
|
|
public function getSubmitUrl(): string
|
|
{
|
|
return $this->getUrl('localetranslate/queue/add');
|
|
}
|
|
|
|
public function getQueueUrl(): string
|
|
{
|
|
return $this->getUrl('localetranslate/queue/index');
|
|
}
|
|
|
|
public function getFormKeyValue(): string
|
|
{
|
|
return $this->formKeyService->getFormKey();
|
|
}
|
|
}
|