You are here

class HistoryRenderCallback in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/history/src/HistoryRenderCallback.php \Drupal\history\HistoryRenderCallback
  2. 10 core/modules/history/src/HistoryRenderCallback.php \Drupal\history\HistoryRenderCallback

Render callback object.

Hierarchy

Expanded class hierarchy of HistoryRenderCallback

File

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

Namespace

Drupal\history
View source
class HistoryRenderCallback implements RenderCallbackInterface {

  /**
   * #lazy_builder callback; attaches the last read timestamp for a node.
   *
   * @param int $node_id
   *   The node ID for which to attach the last read timestamp.
   *
   * @return array
   *   A renderable array containing the last read timestamp.
   */
  public static function lazyBuilder($node_id) {
    $element = [];
    $element['#attached']['drupalSettings']['history']['lastReadTimestamps'][$node_id] = (int) history_read($node_id);
    return $element;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
HistoryRenderCallback::lazyBuilder public static function #lazy_builder callback; attaches the last read timestamp for a node.