init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user