add render array to custom entity in controller I have a custom entity, with a controller class that extends EntityViewController much like the node module does in core. The view method in this class returns a render array $build and it is called by the router for my entity.

I would now like to attach some more content to this render array, specifically some articles from another site. I have a class of my own that I am able to implement like this inside the view() function:

$client = new FrontpageArticlesBuilder();
$articles = $client-&gt;toRenderArray();


Where $articles is a render array. I would like to know how I can append this render array to my existing $build render array returned by view() method in my controller.
You can simply add this to the build array with an arbitrary key name. The only condition is of course that it does not already exist. Every key that does not start with a '#'-sign will be interpreted as another render element or an array of nested render elements.

$build['articles'] = $articles;