#1107: first light_home then async load full home, do not aggregate nor preprocess theme js libraries
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
@@ -3,15 +3,15 @@
|
||||
namespace Drupal\materio_home\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\Datetime\DrupalDateTime;
|
||||
use Drupal\taxonomy\Entity\Term;
|
||||
use Drupal\workflow\Entity\WorkflowManager;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
// use Drupal\Core\Datetime\DrupalDateTime;
|
||||
// use Drupal\taxonomy\Entity\Term;
|
||||
// use Drupal\workflow\Entity\WorkflowManager;
|
||||
// use Drupal\Core\Url;
|
||||
// use Drupal\Core\Language\LanguageInterface;
|
||||
// use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Drupal\Core\Cache\CacheableJsonResponse;
|
||||
use Drupal\Core\Cache\CacheableMetadata;
|
||||
use Drupal\core\render\RenderContext;
|
||||
// use Drupal\Core\Cache\CacheableJsonResponse;
|
||||
// use Drupal\Core\Cache\CacheableMetadata;
|
||||
// use Drupal\core\render\RenderContext;
|
||||
|
||||
|
||||
|
||||
@@ -23,20 +23,24 @@ class HomeController extends ControllerBase {
|
||||
* @return renderable array
|
||||
*/
|
||||
public function home() {
|
||||
|
||||
// return "Hello";
|
||||
// $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
||||
|
||||
$contents = array("#theme"=>'materio_home');
|
||||
|
||||
// presentation
|
||||
$query = \Drupal::entityQuery('node')
|
||||
->condition('status', 1)
|
||||
->condition('nid', 19990);
|
||||
// TODO: présentation nid should be a setting
|
||||
// // presentation
|
||||
// $query = \Drupal::entityQuery('node')
|
||||
// // ->condition('status', 1)
|
||||
// ->condition('nid', 1);
|
||||
// $nids = $query->execute();
|
||||
|
||||
$pres_nid = $query->execute();
|
||||
$contents["#frontpage_node"] = entity_load('node', array_pop($pres_nid));
|
||||
$nid = 1;
|
||||
// TODO: home nid should be a setting
|
||||
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||
$node = $node_storage->load($nid);
|
||||
|
||||
$contents["#frontpage_node"] = $node;
|
||||
$contents["#view_mode"] = "home_light";
|
||||
return $contents;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user