Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 12 commits into from
Jun 3, 2024

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented May 21, 2024

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:

cms/src/Fieldtypes/Code.php

Lines 152 to 154 in 73c48a4

if (! $this->isModeSelectable()) {
return $value['code'];
}

cms/src/Fieldtypes/Code.php

Lines 194 to 197 in 73c48a4

private function isModeSelectable()
{
return $this->config('mode_selectable', false);
}

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

Fixes #10106.

@jasonvarga
Copy link
Member

jasonvarga commented May 31, 2024

I'm gonna split this PR into two. The other half is in #10246.

@jasonvarga
Copy link
Member

I don't consider the "default" changes (like automatic line breaks in markdown) breaking as we expected them as of 5.0.0. I would consider us not changing them to be bugs.

Plus, in 4.x you probably would have the defaults saved to your yaml file (which in automatic line break's case was true), and not even change anyway.

@jasonvarga jasonvarga merged commit 4194c41 into 5.x Jun 3, 2024
18 checks passed
@jasonvarga jasonvarga deleted the merge-config-field-defaults-into-field-config branch June 3, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selected syntax/language doesn't get saved in code field inside Bard
2 participants