Skip to content

Commit

Permalink
fix: Fixed a bug where short links would not work correctly with mult…
Browse files Browse the repository at this point in the history
…i-sites. ([#277](#277))
  • Loading branch information
Hector D. Byrd committed Mar 14, 2023
1 parent 6c2cf39 commit 1c89b9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Retour Changelog

## 4.1.12 - UNRELEASED
### Fixed
* Fixed a bug where short links would not work correctly with multi-sites. ([#277](https://github.com/nystudio107/craft-retour/issues/277))

## 4.1.11 - 2023.03.07
### Added
* Added the ability to disable statistics recording entirely via `enableStatistics` in the `config.php` ([#272](https://github.com/nystudio107/craft-retour/pull/272))
Expand Down
4 changes: 3 additions & 1 deletion src/controllers/TablesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,11 @@ public function actionRedirects(
$redirect['elementTitle'] = '';
$redirect['elementCpUrl'] = '';
$elementId = $redirect['associatedElementId'] ?? null;
$elementSiteId = $redirect['siteId'] ?? null;
if (!empty($elementId)) {
$element = ElementHelper::rootElement(Craft::$app->getElements()->getElementById($elementId));
$element = Craft::$app->getElements()->getElementById($elementId, null, $elementSiteId);
if ($element) {
$element = ElementHelper::rootElement($element);
$redirect['elementTitle'] = $element->title;
$redirect['elementCpUrl'] = $element->getCpEditUrl();
}
Expand Down

0 comments on commit 1c89b9c

Please sign in to comment.