By andypost on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
9.2.x
Introduced in version:
9.2.0
Description:
Introduced swappable HistoryRepository service (history.repository) allows more implementations in contrib modules for different needs implementing a HistoryRepositoryInterface.
Early the history module was limited to store a last view timestamp for node entities only.
Deprecated functions:
history_read($nid) and history_read_multiple($nids) - HistoryRepositoryInterface::getLastViewed($entity_type, $entity_ids, AccountInterface $account)
history_write($nid, AccountInterface $account = NULL) - updateLastViewed(EntityInterface $entity, AccountInterface $account)
$account = \Drupal::currentUser();
$history = $this->historyRepository->getLastViewed('node', array($node->id()), $account);
return $history[$nide->id()];
Impacts:
Module developers