|
@@ -3,15 +3,15 @@
|
|
namespace Drupal\materio_home\Controller;
|
|
namespace Drupal\materio_home\Controller;
|
|
|
|
|
|
use Drupal\Core\Controller\ControllerBase;
|
|
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 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
|
|
* @return renderable array
|
|
*/
|
|
*/
|
|
public function home() {
|
|
public function home() {
|
|
-
|
|
|
|
|
|
+ // return "Hello";
|
|
// $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
|
// $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
|
|
|
|
|
$contents = array("#theme"=>'materio_home');
|
|
$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;
|
|
return $contents;
|
|
}
|
|
}
|
|
|
|
|