Add cObject data to fluid when available

Relates: #9012
This commit is contained in:
Daniel Siepmann 2021-06-16 11:19:11 +02:00
parent ed23c783cd
commit 36ecc9bbe8
3 changed files with 46 additions and 4 deletions

View file

@ -0,0 +1,44 @@
<?php
namespace Wrm\Events\Controller;
/*
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
class AbstractController extends ActionController
{
/**
* Extend original to also add data from current cobject if available.
*/
protected function resolveView()
{
$view = parent::resolveView();
$view->assign('data', []);
$cObject = $this->configurationManager->getContentObject();
if ($cObject instanceof ContentObjectRenderer && is_array($cObject->data)) {
$view->assign('data', $cObject->data);
}
return $view;
}
}

View file

@ -6,7 +6,6 @@ use TYPO3\CMS\Core\Database\QueryGenerator;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use Wrm\Events\Domain\Model\Date;
use Wrm\Events\Domain\Model\Dto\DateDemand;
use Wrm\Events\Domain\Repository\CategoryRepository;
@ -17,7 +16,7 @@ use Wrm\Events\Service\DataProcessingForModels;
/**
* DateController
*/
class DateController extends ActionController
class DateController extends AbstractController
{
/**

View file

@ -3,14 +3,13 @@
namespace Wrm\Events\Controller;
use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use Wrm\Events\Domain\Model\Dto\EventDemand;
use Wrm\Events\Domain\Model\Dto\EventDemandFactory;
use Wrm\Events\Domain\Model\Event;
use Wrm\Events\Domain\Repository\EventRepository;
use Wrm\Events\Service\DataProcessingForModels;
class EventController extends ActionController
class EventController extends AbstractController
{
/**
* @var EventRepository