node.views.inc 969 Bytes
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Provide views data for node.module.
6 7
 */

8
use Drupal\views\Analyzer;
9
use Drupal\views\ViewExecutable;
10

11 12 13 14 15 16 17 18 19 20 21 22 23
/**
 * Implements hook_views_data_alter().
 */
function node_views_data_alter(&$data) {
  $data['node']['node_bulk_form'] = array(
    'title' => t('Node operations bulk form'),
    'help' => t('Add a form element that lets you run operations on multiple nodes.'),
    'field' => array(
      'id' => 'node_bulk_form',
    ),
  );
}

24 25 26
/**
 * Implements hook_preprocess_node().
 */
27 28
function node_row_node_view_preprocess_node(&$variables) {
  $options = $variables['view']->rowPlugin->options;
29 30

  if (!$options['links']) {
31
    unset($variables['content']['links']);
32 33 34
  }
}

35 36 37 38
/**
 * Implements hook_views_wizard().
 */
function node_views_wizard() {
39
  // @todo: figure this piece out.
40
  if (\Drupal::moduleHandler()->moduleExists('statistics')) {
41 42 43 44
    $plugins['node']['available_sorts']['node_counter-totalcount:DESC'] = t('Number of hits');
  }

}