From 5a828bf30acadf089035d2aaf72828c315c104e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Wed, 17 Jul 2019 09:22:38 +0200 Subject: [PATCH] Append hotel category to name on detail page --- .../ext/ep_products/Classes/Domain/Model/Hotel.php | 12 ++++++++++++ .../Resources/Private/Partials/Hotel/Details.html | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php index 33c41e7b..bb13ae80 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php @@ -744,6 +744,18 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te return $this->category; } + /** + * @return string + */ + public function getCategoryLabel() + { + if ($category = $this->getCategory()) { + return static::$categoryLabels[$category]; + } + + return null; + } + /** * @param int $category */ diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/Details.html b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/Details.html index d8855c9d..54f854e9 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/Details.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Partials/Hotel/Details.html @@ -1,7 +1,8 @@ {namespace ep=EP\EpTheme\ViewHelpers} +{hotel.name -> f:format.raw()}{f:if(condition: hotel.categoryLabel, then: ' ({hotel.categoryLabel -> f:format.raw()})')} -
{hotel.name -> f:format.raw()}
-

{hotel.name -> f:format.raw()}

+
{hotelTitle}
+

{hotelTitle}

{hotel.description -> f:format.html()}