Skip to content

Commit ad72556

Browse files
authored
Merge pull request #16676 from craftcms/bugfix/condition-rule-creation-losing-condition-attribute
[4.x][5.x] Fixed condition rules losing their condition when being created
2 parents 3794d6f + 188a742 commit ad72556

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Fixed a bug where “Fit” image transforms were showing the “Default Focal Point” setting. ([#16665](https://github.com/craftcms/cms/pull/16665))
1111
- Fixed a bug where the “Image Position” setting wasn’t saving for “Letterbox” image transforms. ([#16648](https://github.com/craftcms/cms/issues/16648))
1212
- Fixed a bug where the `up` command, the `app/migrate` action, and the Project Config utility weren’t aware of pending project config changes if a database backup was restored but caches weren’t cleared. ([#16668](https://github.com/craftcms/cms/issues/16668))
13+
- Fixed a bug where condition rules weren’t always getting created with their condition set. ([#16676](https://github.com/craftcms/cms/pull/16676))
1314
- Fixed a potential phishing attack vector.
1415

1516
## 4.14.4 - 2025-02-04

src/services/Conditions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ public function createConditionRule(array|string $config): ConditionRuleInterfac
9696
$newClass = ArrayHelper::remove($newConfig, 'class');
9797
}
9898

99+
// Make sure the condition is being passed to the condition rule when it's being constructed
100+
if (isset($config['condition'])) {
101+
$newConfig['condition'] = $config['condition'];
102+
}
103+
99104
// Is the type changing?
100105
if ($class !== null && $newClass !== $class) {
101106
// Remove any config attributes that aren't defined by the same class between both types

0 commit comments

Comments
 (0)