Skip to content

Commit

Permalink
Merge pull request #15911 from craftcms/bugfix/addresses-field-elemen…
Browse files Browse the repository at this point in the history
…t-index-view-mode

have draft addresses show too - consistent with cards mode
  • Loading branch information
brandonkelly authored Oct 21, 2024
2 parents f74f9d5 + e319e6c commit 1a78426
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fixed a bug where it wasn’t possible to scroll the section select modal when moving entries to a different section. ([#15900](https://github.com/craftcms/cms/issues/15900))
- Fixed a bug where query params in the format of `'<operator> <values>'` weren’t being parsed correctly.
- Fixed a bug `craft\services\Entries::saveSection()` and `craft\services\Volumes::saveVolume()` weren’t respecting predefined UUID values on new models.
- Fixed a bug where Addresses fields in element index view weren’t showing newly-created addresses. ([#15911](https://github.com/craftcms/cms/pull/15911))

## 5.4.8 - 2024-10-15

Expand Down
2 changes: 1 addition & 1 deletion src/elements/NestedElementManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ function(string $id, array $config, string $attribute, array &$settings) use ($o
'criteria' => array_merge($criteria, $this->criteria),
'batchSize' => $config['pageSize'],
'actions' => [],
'canHaveDrafts' => $elementType::hasDrafts(),
'canHaveDrafts' => $config['canHaveDrafts'] ?? $elementType::hasDrafts(),
'storageKey' => $config['storageKey'],
'static' => $config['static'],
];
Expand Down
3 changes: 3 additions & 0 deletions src/fields/Addresses.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@ private function inputHtmlInternal(?ElementInterface $owner, bool $static = fals
$config += [
'allowedViewModes' => [ElementIndexViewMode::Cards],
'pageSize' => $this->pageSize ?? 50,
// addresses don't have drafts, but in this particular context we need to allow drafts,
// so that addresses show while adding them via slideout in the element index view mode
'canHaveDrafts' => true,
];

return $this->addressManager()->getIndexHtml($owner, $config);
Expand Down

0 comments on commit 1a78426

Please sign in to comment.