function HistoryViewsHooks::viewsDataAlter

Implements hook_views_data_alter().

Attributes

#[Hook('views_data_alter')]

File

core/modules/history/src/Hook/HistoryViewsHooks.php, line 58

Class

HistoryViewsHooks
Hook implementations for history.

Namespace

Drupal\history\Hook

Code

public function viewsDataAlter(&$data) : void {
  if (!\Drupal::moduleHandler()->moduleExists('comment')) {
    return;
  }
  // New comments are only supported for node table because it requires the
  // history table.
  $data['node']['new_comments'] = [
    'title' => $this->t('New comments'),
    'help' => $this->t('The number of new comments on the node.'),
    'field' => [
      'id' => 'node_new_comments',
      'no group by' => TRUE,
    ],
  ];
}

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