NodeRow.php

Contains \Drupal\node\Plugin\views\row\NodeRow.

Namespace

Drupal\node\Plugin\views\row

File

drupal/core/modules/node/lib/Drupal/node/Plugin/views/row/NodeRow.php
View source
<?php

/**
 * @file
 * Contains \Drupal\node\Plugin\views\row\NodeRow.
 */
namespace Drupal\node\Plugin\views\row;

use Drupal\views\Plugin\views\row\EntityRow;

/**
 * Plugin which performs a node_view on the resulting object.
 *
 * Most of the code on this object is in the theme function.
 *
 * @ingroup views_row_plugins
 */
class NodeRow extends EntityRow {

  /**
   * {@inheritdoc}
   */
  protected function defineOptions() {
    $options = parent::defineOptions();
    $options['view_mode']['default'] = 'teaser';
    $options['links'] = array(
      'default' => TRUE,
      'bool' => TRUE,
    );
    $options['comments'] = array(
      'default' => FALSE,
      'bool' => TRUE,
    );
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, &$form_state) {
    parent::buildOptionsForm($form, $form_state);
    $form['links'] = array(
      '#type' => 'checkbox',
      '#title' => t('Display links'),
      '#default_value' => $this->options['links'],
    );
    $form['comments'] = array(
      '#type' => 'checkbox',
      '#title' => t('Display comments'),
      '#default_value' => $this->options['comments'],
    );
  }

}

Classes

Namesort descending Description
NodeRow Plugin which performs a node_view on the resulting object.