From 773db6676073f2d766016d47781cbc37a209f8b5 Mon Sep 17 00:00:00 2001 From: Ingolf Steinardt Date: Wed, 17 Jul 2024 19:09:59 +0200 Subject: [PATCH] Fix refernce type preference --- src/Render/Setting/Collection.php | 7 ++++--- src/Render/Setting/ICollection.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Render/Setting/Collection.php b/src/Render/Setting/Collection.php index 12a90a6f4..75cdb5675 100644 --- a/src/Render/Setting/Collection.php +++ b/src/Render/Setting/Collection.php @@ -317,7 +317,7 @@ private function lookupJumpTo(bool $translated, string $desired = null, string $ /** * {@inheritdoc} */ - public function buildJumpToUrlFor(IItem $item /**, int $referenceType */) + public function buildJumpToUrlFor(IItem $item /**, ?int $referenceType */) { $information = $this->determineJumpToInformation(); if (empty($information['pageDetails'])) { @@ -349,8 +349,9 @@ public function buildJumpToUrlFor(IItem $item /**, int $referenceType */) $result['url'] = $this->filterUrlBuilder->generate( $filterUrl, - $information['referenceType'] - ?? ((1 < func_num_args()) ? (int) func_get_arg(1) : UrlGeneratorInterface::ABSOLUTE_PATH) + (1 < \func_num_args() && \is_int($referenceType = \func_get_arg(1))) + ? $referenceType + : ($information['referenceType'] ?? UrlGeneratorInterface::ABSOLUTE_PATH) ); return $result; diff --git a/src/Render/Setting/ICollection.php b/src/Render/Setting/ICollection.php index 562cad2d6..46c26e795 100644 --- a/src/Render/Setting/ICollection.php +++ b/src/Render/Setting/ICollection.php @@ -79,9 +79,9 @@ public function getSettingNames(); * Render a filter url for the given item. * * @param IItem $item The item to generate the filter url for. - * @param int $referenceType Optional reference type - mandatory from MetaModels 3.0 on. + * @param ?int $referenceType Optional reference type - fallback to the type passed in the render setting. * * @return array */ - public function buildJumpToUrlFor(IItem $item /**, int $referenceType */); + public function buildJumpToUrlFor(IItem $item /**, ?int $referenceType */); }