cms icon indicating copy to clipboard operation
cms copied to clipboard

[5.x] Merge config field defaults into field config

Open duncanmcclean opened this issue 9 months ago • 0 comments

This pull request fixes #10106, where the Code Fieldtype wouldn't retain the selected mode even when the mode_selectable config option looked like it was enabled (by default, it's set to true).

This was happening since the Code::process() method saves just the code value and not the mode/language when mode_selectable is false:

https://github.com/statamic/cms/blob/73c48a448d4be476f4cc7e70e55e0d7c24e4f1b8/src/Fieldtypes/Code.php#L152-L154

https://github.com/statamic/cms/blob/73c48a448d4be476f4cc7e70e55e0d7c24e4f1b8/src/Fieldtypes/Code.php#L194-L197

This PR fixes that by ensuring the default values for fieldtype config fields are included in the output of Fieldtype::config().

This PR also fixes an issue where default values for common fields (like "replicator preview") weren't being returned by the Blueprints toPublishArray method, which caused replicator previews to not be displayed.

Fixes #10106. Fixes #10198.

duncanmcclean avatar May 21 '24 14:05 duncanmcclean