Skip to content

Commit

Permalink
Merge branch 'hotfix/fix_reference_type_precedence' into 'release/2.3.0'
Browse files Browse the repository at this point in the history
Fix reference type preference

See merge request metamodels/core!302
  • Loading branch information
zonky2 committed Jul 17, 2024
2 parents 5f148df + 773db66 commit 4b01ba1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/Render/Setting/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Render/Setting/ICollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */);
}

0 comments on commit 4b01ba1

Please sign in to comment.