function HistoryRenderCallback::lazyBuilder
Same name in other branches
- 8.9.x core/modules/history/src/HistoryRenderCallback.php \Drupal\history\HistoryRenderCallback::lazyBuilder()
- 10 core/modules/history/src/HistoryRenderCallback.php \Drupal\history\HistoryRenderCallback::lazyBuilder()
- 11.x 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\historyCode
public static function lazyBuilder($node_id) {
$element = [];
$element['#attached']['drupalSettings']['history']['lastReadTimestamps'][$node_id] = (int) history_read($node_id);
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.