You are here

NodeComment.php in Views (for Drupal 7) 8.3

File

lib/Views/comment/Plugin/views/field/NodeComment.php
View source
<?php

/**
 * @file
 * Definition of Views\comment\Plugin\views\field\NodeComment.
 */
namespace Views\comment\Plugin\views\field;

use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;

/**
 * Display node comment status.
 *
 * @ingroup views_field_handlers
 *
 * @Plugin(
 *   id = "node_comment",
 *   module = "comment"
 * )
 */
class NodeComment extends FieldPluginBase {
  function render($values) {
    $value = $this
      ->get_value($values);
    switch ($value) {
      case COMMENT_NODE_HIDDEN:
      default:
        return t('Hidden');
      case COMMENT_NODE_CLOSED:
        return t('Closed');
      case COMMENT_NODE_OPEN:
        return t('Open');
    }
  }

}

Classes

Namesort descending Description
NodeComment Display node comment status.