You are here

public static function HistoryRenderCallback::lazyBuilder in Drupal 8

Same name and namespace in other branches
  1. 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.

1 call to HistoryRenderCallback::lazyBuilder()
history_attach_timestamp in core/modules/history/history.module
#lazy_builder callback; attaches the last read timestamp for a node.

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;
}