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

Matrix field :notempty: field problems #4161

Closed
mofman opened this issue Apr 19, 2019 · 1 comment
Closed

Matrix field :notempty: field problems #4161

mofman opened this issue Apr 19, 2019 · 1 comment

Comments

@mofman
Copy link

mofman commented Apr 19, 2019

Description

Essentially the :notempty: keyword only works when the field is virgin.
Once you have added a block to the field and then saved and then return later to remove all blocks, the :notempty: keyword no longer works and entries will still appear even if they have no blocks.

{% set events = craft.entries.section('whatsOn').eventSuites(':notempty:').all() %}

<h1>Show events which have suites</h1>
{% for event in events %}
    {{ event.title }}<br />
    {{ event.eventSuites|length }}<br />
{% endfor %}

<h1>Show events which do not have suites</h1>
{% set events = craft.entries.section('whatsOn').eventSuites(':empty:').all() %}

{% for event in events %}
    {{ event.title }}<br />
    {{ event.eventSuites|length }}<br />
{% endfor %}

Additional info

  • Craft version: 3.1.23
  • PHP version: 7.2
  • Database driver & version:
  • Plugins & versions:
@brandonkelly
Copy link
Member

Fixed for the next release. Thanks for reporting!

angrybrad pushed a commit that referenced this issue May 6, 2019
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

No branches or pull requests

2 participants