Adding update method to GlobalSets processor which updates global name & field layout
Why
GlobalSets cannot be updated via the cli
Concerns
I am concerned about adding continue here as I am not sure if there is anything necessary further down in the method that this could skip.
Previously, without this continue, the method could reach the bottom, and in turn running both update and save methods for a processor. This would result in console errors because of the 2nd save running, even though the update was successful along the lines of:
home already exists
In addition, not sure sure how to best prep your $errors variable, it seems different in a couple of places. Tried to setup the following:
if ($globalSet === NULL) {
$errors = [
'type' => [
Architect::t('Could not get GlobalSet: '. $item['handle']),
]
];
return [null, $errors];
}
What changes made
$updateSupport
arrayWhy
GlobalSets cannot be updated via the cli
Concerns
I am concerned about adding
continue
here as I am not sure if there is anything necessary further down in the method that this could skip. Previously, without thiscontinue
, the method could reach the bottom, and in turn running bothupdate
andsave
methods for a processor. This would result in console errors because of the 2ndsave
running, even though the update was successful along the lines of:In addition, not sure sure how to best prep your $errors variable, it seems different in a couple of places. Tried to setup the following:
Though with this I get the following response:
Can you suggest how this could be better?
Testing
/var/www/site/update.json
:Run with:
./var/www/site/craft/craft architect/import/update /var/www/site/update.json