feat: conditional rendering of 'courses' teaser in travelinfo
This commit is contained in:
@@ -170,7 +170,7 @@ routeEnhancers:
|
|||||||
extension: EpProducts
|
extension: EpProducts
|
||||||
plugin: travelinfo
|
plugin: travelinfo
|
||||||
limitToPages:
|
limitToPages:
|
||||||
- 2712
|
- 2736
|
||||||
routes:
|
routes:
|
||||||
-
|
-
|
||||||
routePath: '/{travelinfo}/{traveldate}'
|
routePath: '/{travelinfo}/{traveldate}'
|
||||||
|
|||||||
@@ -60,8 +60,10 @@ class TravelinfoController extends ActionController
|
|||||||
|
|
||||||
/** @var Date $date */
|
/** @var Date $date */
|
||||||
$date = $this->dateRepository->findForProductAndDate($product, $travelDate)->getFirst();
|
$date = $this->dateRepository->findForProductAndDate($product, $travelDate)->getFirst();
|
||||||
|
$hasCourses = 0 < count($date->getServicesGeneral('KUR'));
|
||||||
|
|
||||||
$this->view->assign('travelinfo', $travelinfo);
|
$this->view->assign('travelinfo', $travelinfo);
|
||||||
$this->view->assign('date', $date);
|
$this->view->assign('date', $date);
|
||||||
|
$this->view->assign('hasCourses', $hasCourses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -462,9 +462,15 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
|||||||
/**
|
/**
|
||||||
* @return array $servicesGeneral
|
* @return array $servicesGeneral
|
||||||
*/
|
*/
|
||||||
public function getServicesGeneral()
|
public function getServicesGeneral($token = null)
|
||||||
{
|
{
|
||||||
return unserialize($this->servicesGeneral);
|
$services = unserialize($this->servicesGeneral);
|
||||||
|
|
||||||
|
if (null !== $token) {
|
||||||
|
return $services[$token] ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $services;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -113,7 +113,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="container px-4 lg:px-24 flex flex-col space-y-16 pb-16">
|
<div class="container px-4 lg:px-24 flex flex-col space-y-16 pb-16">
|
||||||
<f:for each="{travelinfo.teasers}" as="teaser">
|
<f:for each="{travelinfo.teasers}" as="teaser">
|
||||||
<f:render section="Teaser" arguments="{_all}"/>
|
<f:if condition="{teaser.category} == 'course'">
|
||||||
|
<f:then>
|
||||||
|
<f:if condition="{hasCourses}">
|
||||||
|
<f:render section="Teaser" arguments="{_all}"/>
|
||||||
|
</f:if>
|
||||||
|
</f:then>
|
||||||
|
<f:else>
|
||||||
|
<f:render section="Teaser" arguments="{_all}"/>
|
||||||
|
</f:else>
|
||||||
|
</f:if>
|
||||||
</f:for>
|
</f:for>
|
||||||
</div>
|
</div>
|
||||||
<div id="goodtoknow" class="bg-ep-primary-bg">
|
<div id="goodtoknow" class="bg-ep-primary-bg">
|
||||||
|
|||||||
Reference in New Issue
Block a user