Lines: 100.00%
| Line | Hits | Source |
|---|---|---|
| 1 | <?php | |
| 2 | ||
| 3 | namespace Drupal\visitors\Plugin\views\field; | |
| 4 | ||
| 5 | use Drupal\Core\Session\AccountInterface; | |
| 6 | use Drupal\views\Attribute\ViewsField; | |
| 7 | use Drupal\views\Plugin\views\field\Date; | |
| 8 | ||
| 9 | /** | |
| 10 | * Field handler to display the most recent time the node has been viewed. | |
| 11 | * | |
| 12 | * @ingroup views_field_handlers | |
| 13 | */ | |
| 14 | #[ViewsField("visitors_counter_timestamp")] | |
| 15 | class VisitorsCounterTimestamp extends Date { | |
| 16 | ||
| 17 | /** | |
| 18 | * {@inheritdoc} | |
| 19 | */ | |
| 20 | public function access(AccountInterface $account) { | |
| 21 | 1 | return $account->hasPermission('view visitors counter'); |
| 22 | } | |
| 23 | ||
| 24 | } |