Skip to content

Commit

Permalink
Sort sites by group id
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasNo1 committed Oct 19, 2023
1 parent a22ffd9 commit a56433b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.0.10 - 2023-10-19

### Changed

- The list of sites to copy to is now sorted by site group to provide a better ui for multisite setups [#6](https://github.com/Goldinteractive/craft-sitecopy/issues/6)


## 1.0.9 - 2023-10-16

### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "goldinteractive/craft-sitecopy",
"description": "",
"version": "1.0.9",
"version": "1.0.10",
"license": "proprietary",
"type": "craft-plugin",
"minimum-stability": "dev",
Expand Down
6 changes: 6 additions & 0 deletions src/services/SiteCopy.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function ($site) use ($exclude) {
$site = [
'label' => $site->name,
'value' => $site->id,
'groupId' => $site->groupId,
'inputAttributes' => ['onclick' => 'updateSitecopyToggleAll(this)'],
];
} else {
Expand All @@ -164,11 +165,16 @@ function ($site) use ($exclude) {

$sites = array_filter($sites);

usort($sites, function ($a, $b) {
return $a['groupId'] - $b['groupId'];
});

if (count($sites) > 1) {
array_unshift($sites, [
'id' => 'sitecopy-toggle-all',
'label' => Craft::t('site-copy-x', 'Select all'),
'value' => '',
'groupId' => null,
'inputAttributes' => ['onclick' => 'toggleSitecopyTargets(this)'],
]);
}
Expand Down

0 comments on commit a56433b

Please sign in to comment.