Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore addresses project config data #16193

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed a bug where element indexes were sorting by the first sortable attribute alphabetically by default, rather than the first sortable attribute defined by the element type.
- Fixed a bug where bulk asset actions where shown as available when subfolders were selected, when they shouldn’t have. ([#16151](https://github.com/craftcms/cms/issues/16151))
- Fixed a bug where `craft\events\ApplyFieldSaveEvent::$field` wasn’t being set consistently by `craft\services\Fields::EVENT_BEFORE_APPLY_FIELD_SAVE`. ([#16156](https://github.com/craftcms/cms/issues/16156))
- Fixed a bug where the address field layout’s project config data wasn’t getting recreated when running `project-config/rebuild`. ([#16189](https://github.com/craftcms/cms/issues/16189))

## 4.13.2 - 2024-11-19

Expand Down
22 changes: 22 additions & 0 deletions src/services/ProjectConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Craft;
use craft\db\Query;
use craft\db\Table;
use craft\elements\Address;
use craft\elements\User;
use craft\errors\BusyResourceException;
use craft\errors\OperationAbortedException;
Expand Down Expand Up @@ -1206,6 +1207,7 @@ public function rebuild(): void
// don't touch `meta`
unset($config[self::PATH_META]);

$config[self::PATH_ADDRESSES] = $this->_getAddressesData();
$config[self::PATH_CATEGORY_GROUPS] = $this->_getCategoryGroupData();
$config[self::PATH_DATE_MODIFIED] = DateTimeHelper::currentTimeStamp();
$config[self::PATH_ELEMENT_SOURCES] = $this->_getElementSourceData($config[self::PATH_ELEMENT_SOURCES] ?? []);
Expand Down Expand Up @@ -2060,6 +2062,26 @@ private function _getUserData(array $data): array
return $data;
}



/**
* Return addresses data config array.
*
* @return array
*/
private function _getAddressesData(): array
{
$data = [];
$fieldLayout = Craft::$app->getFields()->getLayoutByType(Address::class);
if ($fieldLayoutConfig = $fieldLayout->getConfig()) {
$data['fieldLayouts'] = [
$fieldLayout->uid => $fieldLayoutConfig,
];
}

return $data;
}

/**
* Return category group data config array.
*
Expand Down