I've created a page layout using panels in the Drupal admin UI (page_machine_id). I'm trying to load that page into a custom controller like so and render one of the variants (Drupal 8):
public function profile() {
$page = \Drupal\page_manager\Entity\Page::load('page_machine_id');
$variants = $page->getVariants();
$pageVariant = end($variants);
$viewer = new \Drupal\page_manager\Entity\PageVariantViewBuilder();
$pageArray = $viewer->view($pageVariant);
return new Response(render($pageArray));
}
This renders the page content correctly, but does not include the theme wrapper around it and I can't figure out how to get the theme to show.
Thanks.
return $pageArray;
should be enough – Clive♦ Nov 22 '18 at 19:34