NodeComment.php

Same filename and directory in other branches
  1. 9 core/modules/comment/src/Plugin/views/filter/NodeComment.php
  2. 8.9.x core/modules/comment/src/Plugin/views/filter/NodeComment.php
  3. 10 core/modules/comment/src/Plugin/views/filter/NodeComment.php

Namespace

Drupal\comment\Plugin\views\filter

File

core/modules/comment/src/Plugin/views/filter/NodeComment.php

View source
<?php

namespace Drupal\comment\Plugin\views\filter;

use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\views\Attribute\ViewsFilter;
use Drupal\views\Plugin\views\filter\InOperator;

/**
 * Filter based on comment node status.
 *
 * @ingroup views_filter_handlers
 */
class NodeComment extends InOperator {
    
    /**
     * {@inheritdoc}
     */
    public function getValueOptions() {
        if (!isset($this->valueOptions)) {
            $this->valueOptions = [
                CommentItemInterface::HIDDEN => $this->t('Hidden'),
                CommentItemInterface::CLOSED => $this->t('Closed'),
                CommentItemInterface::OPEN => $this->t('Open'),
            ];
        }
        return $this->valueOptions;
    }

}

Classes

Title Deprecated Summary
NodeComment Filter based on comment node status.

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