Hi,
'hooks' => [
'site.update:after' => function($newSite, $oldSite) {
if (json_encode($newSite->mapData()->yaml()) != json_encode($oldSite->mapData()->yaml())) {
// mapData is a structure field
$locatedMapData = addLocationsData($newSite->mapData()->yaml(), $oldSite->mapData()->yaml());
F::write('./assets/map-data.json', json_encode($locatedMapData['data']));
}
}
],
mapData
is a structure field.
This script works well but the files data are saved as "cover":["file:\/\/QRaLeNkhnx5hlU53"]
, while I would like to save a complete file object (with name, src, alt etc.). Is it possible to convert them through the yaml()
method ? Is it necessary to loop over each field ?
Thank you for your help.