function NodeComment::getValueOptions

Same name and namespace in other branches
  1. 9 core/modules/comment/src/Plugin/views/filter/NodeComment.php \Drupal\comment\Plugin\views\filter\NodeComment::getValueOptions()
  2. 8.9.x core/modules/comment/src/Plugin/views/filter/NodeComment.php \Drupal\comment\Plugin\views\filter\NodeComment::getValueOptions()
  3. 11.x core/modules/comment/src/Plugin/views/filter/NodeComment.php \Drupal\comment\Plugin\views\filter\NodeComment::getValueOptions()

Gets the value options.

Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

This can use a guard to be used to reduce database hits as much as possible.

Return value

array|null The stored values from $this->valueOptions.

Overrides InOperator::getValueOptions

File

core/modules/comment/src/Plugin/views/filter/NodeComment.php, line 20

Class

NodeComment
Filter based on comment node status.

Namespace

Drupal\comment\Plugin\views\filter

Code

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;
}

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