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

don't show the value input for empty/notempty conditions #12587

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`.
Expand Down
5 changes: 0 additions & 5 deletions src/base/conditions/BaseNumberConditionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ abstract class BaseNumberConditionRule extends BaseTextConditionRule
*/
public string $maxValue = '';

/**
* @inheritdoc
*/
protected bool $reloadOnOperatorChange = true;

/**
* @inheritdoc
*/
Expand Down
9 changes: 9 additions & 0 deletions src/base/conditions/BaseTextConditionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ abstract class BaseTextConditionRule extends BaseConditionRule
*/
public string $value = '';

/**
* @inheritdoc
*/
protected bool $reloadOnOperatorChange = true;

/**
* @inheritdoc
*/
Expand Down Expand Up @@ -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());
Expand Down