public function HistoryUserTimestamp::init in Drupal 10
Same name and namespace in other branches
- 8 core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php \Drupal\history\Plugin\views\field\HistoryUserTimestamp::init()
- 9 core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php \Drupal\history\Plugin\views\field\HistoryUserTimestamp::init()
Overrides Node::init
File
- core/
modules/ history/ src/ Plugin/ views/ field/ HistoryUserTimestamp.php, line 33
Class
- HistoryUserTimestamp
- Field handler to display the marker for new content.
Namespace
Drupal\history\Plugin\views\fieldCode
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
if (\Drupal::currentUser()
->isAuthenticated()) {
$this->additional_fields['created'] = [
'table' => 'node_field_data',
'field' => 'created',
];
$this->additional_fields['changed'] = [
'table' => 'node_field_data',
'field' => 'changed',
];
if (\Drupal::moduleHandler()
->moduleExists('comment') && !empty($this->options['comments'])) {
$this->additional_fields['last_comment'] = [
'table' => 'comment_entity_statistics',
'field' => 'last_comment_timestamp',
];
}
}
}