Skip to content

Commit

Permalink
Merge pull request #16193 from craftcms/bugfix/16189-restore-addresse…
Browse files Browse the repository at this point in the history
…s-pc

restore addresses project config data
  • Loading branch information
brandonkelly authored Nov 22, 2024
2 parents e69fdf8 + 5b5a4a2 commit 9e72c2e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
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

0 comments on commit 9e72c2e

Please sign in to comment.