If you've migrated a Statamic v2 site, you may have sitemap: true set in a collection's section defaults. This causes errors on the section defaults form, and also a Call to a member function fieldtype() on null error that prevents the ability to save an entry.
Though we could have originally addressed this in statamic/migrator, this PR fixes the issue for all users (including those who have already migrated from v2) by normalizing the sitemap's field value here in the addon.
If the data passed in to preprocess is an array, it's returned as-is (this handles a case where we're inheriting from another value).
Otherwise, if this field has a handle of "sitemap" and its original data was true...
4a) ...then return null for that source/value pair so that Statamic can use its default sitemap settings instead of using whatever v2 had set up before migration; or else...
4b) ...return custom with the given value otherwise (i.e., when not dealing with legacy sitemaps).
If you've migrated a Statamic v2 site, you may have
sitemap: true
set in a collection's section defaults. This causes errors on the section defaults form, and also aCall to a member function fieldtype() on null
error that prevents the ability to save an entry.Though we could have originally addressed this in statamic/migrator, this PR fixes the issue for all users (including those who have already migrated from v2) by normalizing the sitemap's field value here in the addon.
Closes #238.