37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\MultiLocaleTranslation\Controller\Adminhtml\Translation;
|
|
|
|
use Esun\MultiLocaleTranslation\Model\StoreViewProvider;
|
|
use Esun\MultiLocaleTranslation\Model\ProviderConfig;
|
|
use Magento\Backend\App\Action;
|
|
use Magento\Backend\App\Action\Context;
|
|
use Magento\Framework\Controller\Result\Json;
|
|
use Magento\Framework\Controller\Result\JsonFactory;
|
|
|
|
class Stores extends Action
|
|
{
|
|
public const ADMIN_RESOURCE = 'Esun_MultiLocaleTranslation::translation';
|
|
|
|
public function __construct(
|
|
Context $context,
|
|
private readonly JsonFactory $jsonFactory,
|
|
private readonly StoreViewProvider $storeViewProvider,
|
|
private readonly ProviderConfig $providerConfig
|
|
) {
|
|
parent::__construct($context);
|
|
}
|
|
|
|
public function execute(): Json
|
|
{
|
|
return $this->jsonFactory->create()->setData([
|
|
'success' => true,
|
|
'stores' => $this->storeViewProvider->getStoreViewOptions(),
|
|
'providers' => $this->providerConfig->getEnabledOptions(),
|
|
'default_provider' => $this->providerConfig->getDefaultProvider(),
|
|
]);
|
|
}
|
|
}
|