By virag.jain on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.3.x
Introduced in version:
11.3.0
Issue links:
Description:
This is a procedural function in node.module that was previously used by statistics and forum modules. It is no longer used by Drupal core.
To replicate the functionality, you can do the following:
$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids);
$items = [];
foreach ($nids as $nid) {
$node = \Drupal::service('entity.repository')->getTranslationFromContext($nodes[$nid]);
$item = $node->toLink()->toRenderable();
$this->renderer->addCacheableDependency($item, $node);
$items[] = $item;
}
return [
'#theme' => 'item_list__node',
'#items' => $items,
'#title' => $title,
'#cache' => [
'tags' => \Drupal::entityTypeManager()->getDefinition('node')->getListCacheTags(),
],
];
Impacts:
Module developers