diff --git a/CHANGELOG.md b/CHANGELOG.md index 928bb079964..d5496f1b6ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/services/ProjectConfig.php b/src/services/ProjectConfig.php index 1b1e2558824..83a1720fe09 100644 --- a/src/services/ProjectConfig.php +++ b/src/services/ProjectConfig.php @@ -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; @@ -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] ?? []); @@ -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. *