1

How to use image field in a condition of an entity query?

To get X nodes which have no image as value of field_image I've tried this:

$nids = \Drupal::entityQuery('node')
->condition('type','X')
->condition('field_image',NULL , '=')
->execute();

it doesn't work I got always empty result.

3

You could try: $query->notExists('field_image');

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.