Skip to content

Commit

Permalink
defaultSort embedded element index config
Browse files Browse the repository at this point in the history
Resolves #16236
  • Loading branch information
brandonkelly committed Dec 1, 2024
1 parent 0f22886 commit f613051
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
- Added `craft\mail\Mailer::$siteId`.
- Added `craft\mail\Mailer::$siteOverrides`.
- Added `craft\models\MailSettings::$siteOverrides`.
- `craft\elements\NestedElementManager::getIndexHtml()` now supports passing `defaultSort` in the `$config` array. ([#16236](https://github.com/craftcms/cms/discussions/16236))
- `craft\helpers\Cp::elementIndexHtml()` now supports passing `defaultSort` in the `$config` array, when `sources` is `null`. ([#16236](https://github.com/craftcms/cms/discussions/16236))
- `craft\models\Site` now implements `craft\base\Chippable`.

### System
Expand Down
2 changes: 2 additions & 0 deletions src/elements/NestedElementManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ public function getIndexHtml(?ElementInterface $owner, array $config = []): stri
'allowedViewModes' => null,
'showHeaderColumn' => true,
'fieldLayouts' => [],
'defaultSort' => null,
'defaultTableColumns' => null,
'prevalidate' => false,
'pageSize' => 50,
Expand Down Expand Up @@ -524,6 +525,7 @@ function(string $id, array $config, string $attribute, array &$settings) use ($o
'showSiteMenu' => false,
'sources' => false,
'fieldLayouts' => $config['fieldLayouts'],
'defaultSort' => $config['defaultSort'],
'defaultTableColumns' => $config['defaultTableColumns'],
'defaultViewMode' => $config['defaultViewMode'],
'registerJs' => false,
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/Cp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ public static function elementIndexHtml(string $elementType, array $config = [])
'showStatusMenu' => 'auto',
'showSiteMenu' => 'auto',
'fieldLayouts' => [],
'defaultSort' => null,
'defaultTableColumns' => null,
'registerJs' => true,
'jsSettings' => [],
Expand Down Expand Up @@ -1291,6 +1292,7 @@ public static function elementIndexHtml(string $elementType, array $config = [])
'key' => '__IMP__',
'label' => Craft::t('app', 'All elements'),
'hasThumbs' => $elementType::hasThumbs(),
'defaultSort' => $config['defaultSort'],
'defaultViewMode' => $config['defaultViewMode'],
],
];
Expand Down

0 comments on commit f613051

Please sign in to comment.