dgrigg / Craft-Migration-Manager

Deprecated - Migration Manager for Craft CMS
MIT License
39 stars 15 forks source link

Type settings for entry field is incorrectly structured #40

Closed my2ter closed 5 years ago

my2ter commented 5 years ago

Hi,

Should be quite simple to fix.

When you create the sources allowed for an Entry field, the migration's code does:

$field['typesettings']['sources'] = join($newSources);

This will generate in your DB:

{"sources":"section:5section:4"

Craft is expecting an array

{"sources":["section:4","section:5"]

Your code should be:

$field['typesettings']['sources'] = in_array('*', $newSources) ? '*' : $newSources;

Hope it does make sense :) Cheers

my2ter commented 5 years ago

FYI,

When you visit the field settings, it does look like Craft allows you to only select those specific sources, but when you use that field on an entry you can actually select everything.

dgrigg commented 5 years ago

@my2ter issue fixed in latest release.