Skip to content

Commit

Permalink
Merge pull request #15038 from craftcms/bugfix/embedded-index-and-rev…
Browse files Browse the repository at this point in the history
…isions

show nested elements in embedded index for revisions
  • Loading branch information
brandonkelly authored May 22, 2024
2 parents acf5b40 + 540afd5 commit 458ba78
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- Fixed a bug where date/time clear buttons could bleed out of their container. ([#15017](https://github.com/craftcms/cms/pull/15017))
- Fixed an error that occurred when editing an element, if any field layout conditions referenced a custom field that was no longer included in the layout. ([#14838](https://github.com/craftcms/cms/issues/14838))
- Fixed a “User not authorized to create this element.” error that could occur when creating a new entry within a Matrix field, if the field had Max Entries set. ([#15015](https://github.com/craftcms/cms/issues/15015))
- Fixed a bug where nested entries weren’t showing up within Matrix fields set to the element index view mode, when viewing entry revisions. ([#15038](https://github.com/craftcms/cms/pull/15038))

## 5.1.4 - 2024-05-17

Expand Down
14 changes: 11 additions & 3 deletions src/elements/NestedElementManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,23 @@ function(string $id, array $config, string $attribute, array &$settings) use ($o
$elementType = $this->elementType;
$view = Craft::$app->getView();

$criteria = [
$this->ownerIdParam => $owner->id,
];

if ($owner->getIsRevision()) {
$criteria['revisions'] = null;
$criteria['trashed'] = null;
$criteria['drafts'] = false;
}

$settings['indexSettings'] = [
'namespace' => $view->getNamespace(),
'allowedViewModes' => $config['allowedViewModes']
? array_map(fn($mode) => StringHelper::toString($mode), $config['allowedViewModes'])
: null,
'showHeaderColumn' => $config['showHeaderColumn'],
'criteria' => array_merge([
$this->ownerIdParam => $owner->id,
], $this->criteria),
'criteria' => array_merge($criteria, $this->criteria),
'batchSize' => $config['pageSize'],
'actions' => [],
'canHaveDrafts' => $elementType::hasDrafts(),
Expand Down

0 comments on commit 458ba78

Please sign in to comment.