Headless
Migration
Follow this guide to migrate between Kirby Headless versions.
Migrating from v3 to v4
Kirby Headless v4 contains a breaking change: the result of the toResolvedBlocks()
field method has changed. Before, the resolved blocks fields were nested within the resolved
key. Now the resolved fields overwrite the original fields. This results in less duplication and a cleaner structure.
Update your frontend code to reflect this change. For example, instead of accessing the resolved
key like block.content.resolved.image[0]
, you can now access the resolved field directly like block.content.image[0]
.
Resolved Key
If you don't want to update your frontend code, you can still update to v4 and use the old structure by defining a resolvedKey
in your config.php
:
config.php
return [
'blocksResolver' => [
'resolvedKey' => 'resolved'
]
];