function Status::query

Same name in this branch
  1. 11.x core/modules/node/src/Plugin/views/filter/Status.php \Drupal\node\Plugin\views\filter\Status::query()
Same name in other branches
  1. 9 core/modules/media/src/Plugin/views/filter/Status.php \Drupal\media\Plugin\views\filter\Status::query()
  2. 9 core/modules/node/src/Plugin/views/filter/Status.php \Drupal\node\Plugin\views\filter\Status::query()
  3. 8.9.x core/modules/media/src/Plugin/views/filter/Status.php \Drupal\media\Plugin\views\filter\Status::query()
  4. 8.9.x core/modules/node/src/Plugin/views/filter/Status.php \Drupal\node\Plugin\views\filter\Status::query()
  5. 10 core/modules/media/src/Plugin/views/filter/Status.php \Drupal\media\Plugin\views\filter\Status::query()
  6. 10 core/modules/node/src/Plugin/views/filter/Status.php \Drupal\node\Plugin\views\filter\Status::query()

Overrides FilterPluginBase::query

File

core/modules/media/src/Plugin/views/filter/Status.php, line 37

Class

Status
Filter by published status.

Namespace

Drupal\media\Plugin\views\filter

Code

public function query() {
    $table = $this->ensureMyTable();
    $snippet = "{$table}.status = 1 OR ({$table}.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_MEDIA*** = 1) OR ***ADMINISTER_MEDIA*** = 1";
    if ($this->moduleHandler
        ->moduleExists('content_moderation')) {
        $snippet .= ' OR ***VIEW_ANY_UNPUBLISHED_NODES*** = 1';
    }
    $this->query
        ->addWhereExpression($this->options['group'], $snippet);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.