Hello,
I am trying to null some fields that are apparently empty on the secondary language, but still appear in the content file, so they do not use the primary language content as fallback.
I’ve been able to do so with one field, but not this other one:
description:
label: Description
type: writer
marks:
- italic
- bold
- link
nodes: false
My update code:
$kirby->impersonate('kirby');
foreach (page('works')->childrenAndDrafts()->template('work') as $w) {
if ($w->content('en')->description()->isEmpty()) {
echo $w->title() . '<br />';
try {
$w->update([
'description' => null
], 'en');
} catch (Exception $e) {
dump($e);
}
}
}
The code prints the titles of the pages who have an empty description field correctly. No exception is caught. But when I look at the content file the field is still there, empty:
Description:
----
Am I doing anything wrong ? or this is expected for some reason ?
Thanks