Skip to content

Commit

Permalink
Fix rare fieldtype() on null error, preventing the ability to save …
Browse files Browse the repository at this point in the history
…an entry (#240)
  • Loading branch information
jesseleite authored Nov 30, 2022
1 parent 7669ee4 commit 216887d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Fieldtypes/SourceFieldtype.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ public function preProcess($data)
return ['source' => 'inherit', 'value' => $data];
}

// Handle issue with legacy `sitemap: true` section default.
// This shouldn't ever be explicitly set `true` in Statamic v3,
// but it may be migrated as `true` when coming from Statamic v2.
if ($this->field->handle() === 'sitemap' && $originalData === true) {
return ['source' => 'inherit', 'value' => null];
}

return ['source' => 'custom', 'value' => $data];
}

Expand Down

0 comments on commit 216887d

Please sign in to comment.