diff --git a/CHANGELOG.md b/CHANGELOG.md index b715ea730b5..14737f34756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Fixed a bug where accessing a custom field’s magic property on an element would return the field’s raw database value rather than `null`, if it didn’t belong to the element’s field layout anymore. ([#12539](https://github.com/craftcms/cms/issues/12539), [#12578](https://github.com/craftcms/cms/pull/12578)) - Fixed a bug where previewing an asset could wipe out all `h1` tags within Redactor fields. ([#12545](https://github.com/craftcms/cms/issues/12545)) - Fixed a bug where `craft\image\Raster::getIsTransparent()` wasn’t working. ([#12565](https://github.com/craftcms/cms/issues/12565)) +- Fixed a bug where textual condition rules were still showing a text input when the “is empty” or “has a value” operators were selected. ([#12587](https://github.com/craftcms/cms/pull/12587)) - Added `craft\helpers\Db::escapeForLike()`. - `craft\services\Assets::getAllDescendantFolders()` now has a `$withParent` argument, which can be passed `false` to omit the parent folder from the results. ([#12536](https://github.com/craftcms/cms/issues/12536)) - Deprecated `craft\helpers\DateTimeHelper::timeZoneAbbreviation()`. diff --git a/src/base/conditions/BaseNumberConditionRule.php b/src/base/conditions/BaseNumberConditionRule.php index ce24a6692be..6560c078b12 100644 --- a/src/base/conditions/BaseNumberConditionRule.php +++ b/src/base/conditions/BaseNumberConditionRule.php @@ -26,11 +26,6 @@ abstract class BaseNumberConditionRule extends BaseTextConditionRule */ public string $maxValue = ''; - /** - * @inheritdoc - */ - protected bool $reloadOnOperatorChange = true; - /** * @inheritdoc */ diff --git a/src/base/conditions/BaseTextConditionRule.php b/src/base/conditions/BaseTextConditionRule.php index 109c4df0e34..66e95c677b3 100644 --- a/src/base/conditions/BaseTextConditionRule.php +++ b/src/base/conditions/BaseTextConditionRule.php @@ -26,6 +26,11 @@ abstract class BaseTextConditionRule extends BaseConditionRule */ public string $value = ''; + /** + * @inheritdoc + */ + protected bool $reloadOnOperatorChange = true; + /** * @inheritdoc */ @@ -68,6 +73,10 @@ protected function inputType(): string */ protected function inputHtml(): string { + // don't show the value input if the condition checks for empty/notempty + if ($this->operator === self::OPERATOR_EMPTY || $this->operator === self::OPERATOR_NOT_EMPTY) { + return ''; + } return Html::hiddenLabel(Html::encode($this->getLabel()), 'value') . Cp::textHtml($this->inputOptions());