Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293237

Use EntityQuery and filter by moderation state

$
0
0

Problem/Motivation

It is not possible use Entity Query to filter nodes with content moderation module enabled.

When I debug a node with this config enabled, I cant find a field with this value.

$query = \Drupal::entityQuery('node')
    ->condition('type', 'article', '=')
    ->condition('moderation_state', 'archived', '=');
  $nids = $query->execute();

But here it works

$node = Node::load($nid);
$node->get('moderation_state')->getValue();

Proposed resolution

Find a way that we can add a condition to filter content with EntityQuery by moderation_state field.


Viewing all articles
Browse latest Browse all 293237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>