Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / statistics / src / Plugin / Block / StatisticsPopularBlock.php
index 1802a4569c3f42b70ad881028c1bf636a5a96020..f0ac482d381d8594c58efb63b9c8bc599e4ae26f 100644 (file)
@@ -194,11 +194,7 @@ class StatisticsPopularBlock extends BlockBase implements ContainerFactoryPlugin
     $items = [];
     foreach ($nids as $nid) {
       $node = $this->entityRepository->getTranslationFromContext($nodes[$nid]);
-      $item = [
-        '#type' => 'link',
-        '#title' => $node->getTitle(),
-        '#url' => $node->urlInfo('canonical'),
-      ];
+      $item = $node->toLink()->toRenderable();
       $this->renderer->addCacheableDependency($item, $node);
       $items[] = $item;
     }