filter for entries with previewPicture

This commit is contained in:
Nicolas Lœuillet 2015-09-12 17:08:12 +02:00
parent 9c08a891f9
commit a3bcd60a37
2 changed files with 15 additions and 2 deletions

View file

@ -42,7 +42,14 @@ class EntryFilterType extends AbstractType
}, },
)) ))
->add('isArchived', 'filter_checkbox') ->add('isArchived', 'filter_checkbox')
->add('isStarred', 'filter_checkbox'); ->add('isStarred', 'filter_checkbox')
->add('previewPicture', 'filter_checkbox', array(
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
$expression = $filterQuery->getExpr()->isNotNull($field);
return $filterQuery->createCondition($expression);
},
));
} }
public function getName() public function getName()

View file

@ -71,6 +71,12 @@
<div class="col s12"> <div class="col s12">
<label>{% trans %}Status{% endtrans %}</label> <label>{% trans %}Status{% endtrans %}</label>
</div> </div>
<div class="input-field col s6">
{{ form_widget(form.previewPicture) }}
<label for="entry_filter_previewPicture">{% trans %}Has a preview picture{% endtrans %}</label>
</div>
<div class="input-field col s6"> <div class="input-field col s6">
{{ form_widget(form.isArchived) }} {{ form_widget(form.isArchived) }}
<label for="entry_filter_isArchived">{% trans %}Archived{% endtrans %}</label> <label for="entry_filter_isArchived">{% trans %}Archived{% endtrans %}</label>