You are here

public static function HistoryRenderCallback::lazyBuilder in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/history/src/HistoryRenderCallback.php \Drupal\history\HistoryRenderCallback::lazyBuilder()
  2. 9 core/modules/history/src/HistoryRenderCallback.php \Drupal\history\HistoryRenderCallback::lazyBuilder()

#lazy_builder callback; attaches the last read timestamp for a node.

Parameters

int $node_id: The node ID for which to attach the last read timestamp.

Return value

array A renderable array containing the last read timestamp.

File

core/modules/history/src/HistoryRenderCallback.php, line 21

Class

HistoryRenderCallback
Render callback object.

Namespace

Drupal\history

Code

public static function lazyBuilder($node_id) {
  $element = [];
  $element['#attached']['drupalSettings']['history']['lastReadTimestamps'][$node_id] = (int) history_read($node_id);
  return $element;
}