Skip to content

Commit

Permalink
Fixed #4939
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Sep 13, 2019
1 parent 2a1e5dc commit e6cd1b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed
- Fixed a bug where asset queries’ `withTransforms` param wasn’t working for eager-loaded assets. ([#4931](https://github.com/craftcms/cms/issues/4931))
- Fixed a bug where the "Edit Image" element action sometimes would be missing. ([#3349](https://github.com/craftcms/cms/issues/3349))
- Fixed a bug where querying for elements by their Lightswitch field value could only return elements that had been saved since the Lightswitch field was added. ([#4939](https://github.com/craftcms/cms/issues/4939))

## 3.3.3 - 2019-09-12

Expand Down
9 changes: 9 additions & 0 deletions src/fields/Lightswitch.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use craft\base\Field;
use craft\base\PreviewableFieldInterface;
use craft\base\SortableFieldInterface;
use craft\elements\db\ElementQueryInterface;
use GraphQL\Type\Definition\Type;
use yii\db\Schema;

Expand Down Expand Up @@ -118,6 +119,14 @@ public function normalizeValue($value, ElementInterface $element = null)
return (bool)$value;
}

/**
* @inheritdoc
*/
public function modifyElementsQuery(ElementQueryInterface $query, $value)
{
return parent::modifyElementsQuery($query, $value ? ':notempty:' : ':empty:');
}

/**
* @inheritdoc
*/
Expand Down

0 comments on commit e6cd1b1

Please sign in to comment.