From cca8ed197036fdb22fbed2876bbbe23377b19a21 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 11 Jan 2021 01:59:31 +0000 Subject: [PATCH] Re-order array by key [ci skip] References #3 --- web/modules/custom/blog/src/Plugin/Block/RelatedPostsBlock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/modules/custom/blog/src/Plugin/Block/RelatedPostsBlock.php b/web/modules/custom/blog/src/Plugin/Block/RelatedPostsBlock.php index deb53e7..8fafbe2 100644 --- a/web/modules/custom/blog/src/Plugin/Block/RelatedPostsBlock.php +++ b/web/modules/custom/blog/src/Plugin/Block/RelatedPostsBlock.php @@ -68,12 +68,12 @@ class RelatedPostsBlock extends BlockBase implements ContainerFactoryPluginInter 'max-age' => 604800, 'tags' => ["node:{$currentPost->id()}"], ], - '#theme' => 'item_list', '#items' => $relatedPosts ->sortByDesc(fn(Post $post) => $post->getCreatedTime()) ->map(fn(Post $post) => $this->generateLinkToPost($post)) ->slice(0, 3) ->toArray(), + '#theme' => 'item_list', ]; return $build;