75 lines
1.7 KiB
PHP
75 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Evomedien\Vitec\Controller;
|
|
|
|
use Evomedien\Vitec\Domain\Repository\MarketRepository;
|
|
use Evomedien\Vitec\Domain\Model\Market;
|
|
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
/**
|
|
* This file is part of the "VITEC" Extension for TYPO3 CMS.
|
|
*
|
|
* For the full copyright and license information, please read the
|
|
* LICENSE.txt file that was distributed with this source code.
|
|
*
|
|
* (c) 2025
|
|
*/
|
|
|
|
/**
|
|
* MarketController
|
|
*/
|
|
class MarketController extends ActionController
|
|
{
|
|
/**
|
|
* marketRepository
|
|
*
|
|
* @var MarketRepository
|
|
*/
|
|
protected $marketRepository;
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param MarketRepository $marketRepository
|
|
*/
|
|
public function __construct(MarketRepository $marketRepository)
|
|
{
|
|
$this->marketRepository = $marketRepository;
|
|
}
|
|
|
|
/**
|
|
* action show
|
|
*
|
|
* @return ResponseInterface
|
|
*/
|
|
public function showAction(): ResponseInterface
|
|
{
|
|
$selectedMarketId = (int)$this->settings['market'];
|
|
$market = null;
|
|
if ($selectedMarketId) {
|
|
$market = $this->marketRepository->findByUid($selectedMarketId);
|
|
}
|
|
|
|
$this->view->assign('market', $market);
|
|
|
|
return $this->htmlResponse();
|
|
}
|
|
|
|
/**
|
|
* action list
|
|
*
|
|
* Extbase registration target for the Marketlist plugin. In headless mode
|
|
* the JSON output is produced by MarketListJsonRenderer, not by this
|
|
* controller — same arrangement as LocationController::listAction().
|
|
*
|
|
* @return ResponseInterface
|
|
*/
|
|
public function listAction(): ResponseInterface
|
|
{
|
|
return $this->htmlResponse();
|
|
}
|
|
}
|