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->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.