mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-10 07:56:11 +01:00
Daniel Siepmann
0fe793307a
Add event to alter the View Variables in foreign code. This is used for grouped dates list on weimar.
105 lines
2 KiB
PHP
105 lines
2 KiB
PHP
<?php
|
|
|
|
namespace Wrm\Events\Events\Controller;
|
|
|
|
use TYPO3\CMS\Extbase\Domain\Model\Category;
|
|
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
|
|
use Wrm\Events\Domain\Model\Dto\DateDemand;
|
|
use Wrm\Events\Domain\Model\Region;
|
|
|
|
class DateSearchVariables
|
|
{
|
|
/**
|
|
* @var array
|
|
*/
|
|
private $search;
|
|
|
|
/**
|
|
* @var DateDemand
|
|
*/
|
|
private $demand;
|
|
|
|
/**
|
|
* @var QueryResultInterface<Region>
|
|
*/
|
|
private $regions;
|
|
|
|
/**
|
|
* @var array<Category>
|
|
*/
|
|
private $categories;
|
|
|
|
/**
|
|
* @var array<Category>
|
|
*/
|
|
private $features;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private $variables = [];
|
|
|
|
/**
|
|
* @param QueryResultInterface<Region> $regions
|
|
*/
|
|
public function __construct(
|
|
array $search,
|
|
DateDemand $demand,
|
|
QueryResultInterface $regions,
|
|
array $categories,
|
|
array $features
|
|
) {
|
|
$this->search = $search;
|
|
$this->demand = $demand;
|
|
$this->regions = $regions;
|
|
$this->categories = $categories;
|
|
$this->features = $features;
|
|
}
|
|
|
|
public function getSearch(): array
|
|
{
|
|
return $this->search;
|
|
}
|
|
|
|
public function getDemand(): DateDemand
|
|
{
|
|
return $this->demand;
|
|
}
|
|
|
|
/**
|
|
* @return QueryResultInterface<Region>
|
|
*/
|
|
public function getRegions(): QueryResultInterface
|
|
{
|
|
return $this->regions;
|
|
}
|
|
|
|
public function getCategories(): array
|
|
{
|
|
return $this->categories;
|
|
}
|
|
|
|
public function getFeatures(): array
|
|
{
|
|
return $this->features;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $value
|
|
*/
|
|
public function addVariable(string $key, $value): void
|
|
{
|
|
$this->variables[$key] = $value;
|
|
}
|
|
|
|
public function getVariablesForView(): array
|
|
{
|
|
return array_merge([
|
|
'search' => $this->search,
|
|
'demand' => $this->demand,
|
|
'regions' => $this->regions,
|
|
'categories' => $this->categories,
|
|
'features' => $this->features,
|
|
], $this->variables);
|
|
}
|
|
}
|