#1107: first light_home then async load full home, do not aggregate nor preprocess theme js libraries

This commit is contained in:
2021-05-25 22:22:00 +02:00
parent afb929c042
commit c1b9d16216
14 changed files with 182 additions and 51 deletions

View File

@@ -74,14 +74,18 @@ class AjaxHomeController extends ControllerBase {
*/
public function getHome() {
$path = \Drupal::config('system.site')->get('page.front');
// $path = \Drupal::config('system.site')->get('page.front');
// $params = Url::fromUri("internal:" . $path)->getRouteParameters();
// $entity_type = key($params);
// $entity = $this->entityTypeManager()->getStorage($entity_type)->load($params[$entity_type]);
$params = Url::fromUri("internal:" . $path)->getRouteParameters();
$entity_type = key($params);
$entity = $this->entityTypeManager()->getStorage($entity_type)->load($params[$entity_type]);
$nid = 1;
// TODO: home nid should be a setting
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
$node = $node_storage->load($nid);
$view_builder = $this->entityTypeManager()->getViewBuilder('node');
$renderable = $view_builder->view($entity, 'default');
$renderable = $view_builder->view($node, 'home_full');
$rendered = $this->renderer->executeInRenderContext(new RenderContext(), function () use ($renderable) {
return render($renderable);
});