Remove superflous plugin, adjust viewhelper to use exsiting plugin
This commit is contained in:
@@ -99,6 +99,17 @@ routeEnhancers:
|
||||
extension: EpProducts
|
||||
plugin: product_detail
|
||||
routes:
|
||||
-
|
||||
routePath: '/detail/{product}'
|
||||
_controller: 'Product::detail'
|
||||
_arguments:
|
||||
product: product
|
||||
-
|
||||
routePath: '/detail/{product}/{hotel}'
|
||||
_controller: 'Product::detail'
|
||||
_arguments:
|
||||
product: product
|
||||
hotel: hotel
|
||||
-
|
||||
routePath: '/detail/{product_uid}/{hotel_uid}'
|
||||
_controller: 'Product::detail'
|
||||
@@ -113,6 +124,14 @@ routeEnhancers:
|
||||
date_to: dateTo
|
||||
defaultController: 'Product::detail'
|
||||
aspects:
|
||||
product:
|
||||
type: PersistedAliasMapper
|
||||
tableName: tx_epproducts_domain_model_product
|
||||
routeFieldName: path_segment
|
||||
hotel:
|
||||
type: PersistedAliasMapper
|
||||
tableName: tx_epproducts_domain_model_hotel
|
||||
routeFieldName: path_segment
|
||||
product_uid:
|
||||
type: PersistedAliasMapper
|
||||
tableName: tx_epproducts_domain_model_product
|
||||
@@ -130,24 +149,6 @@ routeEnhancers:
|
||||
hotel_uid: \d+
|
||||
date_from: '\d{4}\-\d{2}\-\d{2}'
|
||||
date_to: '\d{4}\-\d{2}\-\d{2}'
|
||||
BookingLinkPlugin:
|
||||
type: Extbase
|
||||
extension: EpProducts
|
||||
plugin: booking_link
|
||||
limitToPages:
|
||||
- 1846
|
||||
routes:
|
||||
-
|
||||
routePath: '/{product}'
|
||||
_controller: 'Product::detail'
|
||||
_arguments:
|
||||
product: product
|
||||
defaultController: 'Product::detail'
|
||||
aspects:
|
||||
product:
|
||||
type: PersistedAliasMapper
|
||||
tableName: tx_epproducts_domain_model_product
|
||||
routeFieldName: path_segment
|
||||
ContingentsIcalPlugin:
|
||||
type: Extbase
|
||||
extension: EpProducts
|
||||
|
||||
@@ -23,12 +23,6 @@ call_user_func(function () {
|
||||
'Produkt: Details'
|
||||
);
|
||||
|
||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
|
||||
'EP.EpProducts',
|
||||
'booking_link',
|
||||
'Buchungslink'
|
||||
);
|
||||
|
||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
|
||||
'EP.EpProducts',
|
||||
'product_teasergroup',
|
||||
|
||||
@@ -69,14 +69,6 @@ $boot = function () {
|
||||
]
|
||||
);
|
||||
|
||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||
'EP.ep_products',
|
||||
'booking_link',
|
||||
[
|
||||
'Product' => 'detail,hotelList',
|
||||
]
|
||||
);
|
||||
|
||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
|
||||
'EP.ep_products',
|
||||
'product_teasergroup',
|
||||
|
||||
@@ -27,10 +27,6 @@ namespace EP\EpTheme\ViewHelpers\Uri;
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpEvents\Domain\Model\Hotel;
|
||||
use EP\EpProducts\Domain\Model\Product;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
@@ -45,10 +41,9 @@ class ProductViewHelper extends AbstractViewHelper
|
||||
|
||||
$this->registerArgument('product', 'mixed', 'The product');
|
||||
$this->registerArgument('hotel', 'array', 'The hotel');
|
||||
$this->registerArgument('forceHotelUid', 'bool', 'Whether to force link a hotel');
|
||||
$this->registerArgument('dateFrom', 'string', 'Date to limit table on detail page by (Y-m-d)');
|
||||
$this->registerArgument('dateTo', 'string', 'Date to limit table on detail page by (Y-m-d)');
|
||||
$this->registerArgument('forceHotelUid', 'bool', 'Whether to force link a hotel');
|
||||
$this->registerArgument('slug', 'string', 'Slug to append to resulting uri');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,56 +56,38 @@ class ProductViewHelper extends AbstractViewHelper
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
)
|
||||
{
|
||||
) {
|
||||
$product = $arguments['product'];
|
||||
$hotel = $arguments['hotel'];
|
||||
|
||||
$linkArguments = null;
|
||||
|
||||
if ($arguments['forceHotelUid']) {
|
||||
// Product detail page with forced hotel
|
||||
$linkArguments = [
|
||||
'product' => is_array($product) ? $product['uid'] : $product,
|
||||
'hotel' => is_array($hotel) ? $hotel['uid'] : $hotel,
|
||||
];
|
||||
} elseif ($arguments['dateFrom'] || $arguments['dateTo']) {
|
||||
// Product detail page with forced date range
|
||||
$linkArguments = [
|
||||
'dateFrom' => $arguments['dateFrom'],
|
||||
'dateTo' => $arguments['dateTo'],
|
||||
];
|
||||
} else {
|
||||
// Default product detail page by product uid
|
||||
$linkArguments = [
|
||||
'product' => is_array($product) ? $product['uid'] : $product,
|
||||
];
|
||||
}
|
||||
|
||||
if (null !== $linkArguments) {
|
||||
$targetPageUid = is_array($product) ? (int)$product['detailPage'] : $product->getDetailPage();
|
||||
$uri = $renderingContext
|
||||
|
||||
return $renderingContext
|
||||
->getControllerContext()
|
||||
->getUriBuilder()
|
||||
->reset()
|
||||
->setTargetPageUid($targetPageUid)
|
||||
->uriFor('detail', $linkArguments, 'Product', 'epproducts', 'product_detail')
|
||||
;
|
||||
} else {
|
||||
/** @var ContentObjectRenderer $contentObject */
|
||||
$contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class);
|
||||
if (is_array($product)) {
|
||||
$param = $product['detailPage'];
|
||||
} elseif (null !== $product) {
|
||||
$param = $product->getUid();
|
||||
} else {
|
||||
$param = null;
|
||||
}
|
||||
$uri = $contentObject->typoLink_URL(
|
||||
[
|
||||
'parameter' => $param,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($arguments['slug']) {
|
||||
$uri .= $arguments['slug'].'/';
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<f:section name="TeaserImage">
|
||||
<div class="relative{f:if(condition: landscape, then: ' sm:w-2/5')}">
|
||||
<a href="{ep:uri.product(forceHotelUid: forceHotelUid, product: product, hotel: hotel, dateFrom: dateFrom, dateTo: dateTo, slug: slug)}{f:if(condition: referringPageUri, then: '?ref={referringPageUri -> f:format.urlencode()}')}"
|
||||
<a href="{ep:uri.product(forceHotelUid: forceHotelUid, product: product, hotel: hotel, dateFrom: dateFrom, dateTo: dateTo)}{f:if(condition: referringPageUri, then: '?ref={referringPageUri -> f:format.urlencode()}')}"
|
||||
title="{region.name} {product.name} Details und Buchen">
|
||||
<f:if condition="{productImage}">
|
||||
<f:then>
|
||||
@@ -56,7 +56,7 @@
|
||||
</f:section>
|
||||
|
||||
<f:section name="TeaserContent">
|
||||
<a href="{ep:uri.product(forceHotelUid: forceHotelUid, product: product, hotel: hotel, dateFrom: dateFrom, dateTo: dateTo, slug: slug)}{f:if(condition: referringPageUri, then: '?ref={referringPageUri -> f:format.urlencode()}')}"
|
||||
<a href="{ep:uri.product(forceHotelUid: forceHotelUid, product: product, hotel: hotel, dateFrom: dateFrom, dateTo: dateTo)}{f:if(condition: referringPageUri, then: '?ref={referringPageUri -> f:format.urlencode()}')}"
|
||||
title="{region.name} {product.name} Details und Buchen"
|
||||
class="flex-1 flex flex-col space-y-1 px-2 py-4 md:p-4">
|
||||
<div class="product-teaser__label-name">
|
||||
|
||||
-1
@@ -21,7 +21,6 @@
|
||||
forceHotelUid: teaser.forceHotelUid,
|
||||
dateFrom: dateFrom,
|
||||
dateTo: dateTo,
|
||||
slug: teaser.product.slug,
|
||||
landscape: '{f:if(condition: \'{data.layout} == 2 || {data.layout} == 3\', then: 1, else: 0)}'
|
||||
}"/>
|
||||
</f:if>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
concept: product.concept,
|
||||
hotel: item.hotel,
|
||||
product: product,
|
||||
slug: product.slug,
|
||||
country: product.country,
|
||||
region: product.region,
|
||||
productImage: item.hotel.images.original.0,
|
||||
|
||||
Reference in New Issue
Block a user