Skip to content

Commit

Permalink
Fixed #4705
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Aug 5, 2019
1 parent 03edd94 commit 29c964a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Fixed a bug where `craft\base\Element::getDescendants()` and other structure methods could return the wrong results when called on a draft. ([#4694](https://github.com/craftcms/cms/issues/4694))
- Fixed a bug where Matrix blocks weren’t getting duplicated to newly-enabled sites for elements if the field’s Propagation Method setting wasn’t set to “Save blocks to all sites the owner element is saved in”. ([#4698](https://github.com/craftcms/cms/issues/4698))
- Fixed a bug where the Database Backup could result in a 404 error on load-balanced environments. ([#4699](https://github.com/craftcms/cms/issues/4699))
- Fixed a bug where the “Current” entry revision link wouldn’t always work. ([#4705](https://github.com/craftcms/cms/issues/4705))

## 3.2.8 - 2019-07-30

Expand Down
3 changes: 0 additions & 3 deletions src/elements/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,6 @@ public function getCpEditUrl()
if (Craft::$app->getIsMultiSite()) {
$params['site'] = $this->getSite()->handle;
}
if ($this->getIsDraft()) {
$params['draftId'] = $this->draftId;
}

return UrlHelper::cpUrl($path, $params);
}
Expand Down
7 changes: 7 additions & 0 deletions src/web/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use craft\helpers\Json;
use craft\helpers\Path;
use craft\helpers\StringHelper;
use craft\helpers\UrlHelper;
use craft\web\twig\Environment;
use craft\web\twig\Extension;
use craft\web\twig\Template;
Expand Down Expand Up @@ -1775,6 +1776,12 @@ private function _getCpElementHtml(array &$context)
$encodedLabel = HtmlHelper::encode($label);

if ($context['context'] === 'index' && !$element->trashed && ($cpEditUrl = $element->getCpEditUrl())) {
if ($element->getIsDraft()) {
$cpEditUrl = UrlHelper::urlWithParams($cpEditUrl, ['draftId' => $element->draftId]);
} else if ($element->getIsRevision()) {
$cpEditUrl = UrlHelper::urlWithParams($cpEditUrl, ['revisionId' => $element->revisionId]);
}

$cpEditUrl = HtmlHelper::encode($cpEditUrl);
$html .= "<a href=\"{$cpEditUrl}\">{$encodedLabel}</a>";
} else {
Expand Down

0 comments on commit 29c964a

Please sign in to comment.