function hooks_example_hooks_example_count_incremented

Same name in other branches
  1. 3.x modules/hooks_example/hooks_example.module \hooks_example_hooks_example_count_incremented()

Implements hook_hooks_example_count_incremented().

Hooks can be implemented by both the module that invokes them like we are doing here, as well as by any other enabled module.

Related topics

File

modules/hooks_example/hooks_example.module, line 218

Code

function hooks_example_hooks_example_count_incremented($current_count, NodeInterface $node) {
    if ($current_count === 1) {
        \Drupal::messenger()->addMessage(t('This is the first time you have viewed the node %title.', [
            '%title' => $node->label(),
        ]));
    }
}