You are here

public static function OpignoTourFunctions::savePageUserViewed in Opigno tour 8

Same name and namespace in other branches
  1. 3.x src/OpignoTourFunctions.php \Drupal\opigno_tour\OpignoTourFunctions::savePageUserViewed()

Saves user and current route.

1 call to OpignoTourFunctions::savePageUserViewed()
opigno_tour_preprocess_page in ./opigno_tour.module
Implements hook_preprocess_page().

File

src/OpignoTourFunctions.php, line 51

Class

OpignoTourFunctions
Class OpignoTourFunctions.

Namespace

Drupal\opigno_tour

Code

public static function savePageUserViewed($route_name, $uid) {
  try {
    \Drupal::database()
      ->insert('opigno_tour_user_routes')
      ->fields([
      'uid' => $uid,
      'route' => $route_name,
      'timestamp' => time(),
    ])
      ->execute();
  } catch (\Exception $e) {
    \Drupal::logger('opigno_tour')
      ->error($e
      ->getMessage());
  }
}