|
@@ -16,18 +16,36 @@ class HomeController extends ControllerBase {
|
|
*/
|
|
*/
|
|
public function home() {
|
|
public function home() {
|
|
|
|
|
|
- $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
|
|
|
|
|
+ // $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
|
|
|
|
|
$contents = array("#theme"=>'edlp_home');
|
|
$contents = array("#theme"=>'edlp_home');
|
|
|
|
|
|
- // presentation
|
|
|
|
|
|
+ // first get static pages
|
|
|
|
+ $query = \Drupal::entityQuery('node')
|
|
|
|
+ ->condition('status', 1)
|
|
|
|
+ ->condition('field_afficher_en_page_d_acceuil', 1)
|
|
|
|
+ ->condition('type', 'static');
|
|
|
|
+
|
|
|
|
+ $promoted_nids = $query->execute();
|
|
|
|
+ $contents["#promoted_nodes"] = entity_load_multiple('node', $promoted_nids);
|
|
|
|
+
|
|
|
|
+ // then get production pages
|
|
$query = \Drupal::entityQuery('node')
|
|
$query = \Drupal::entityQuery('node')
|
|
->condition('status', 1)
|
|
->condition('status', 1)
|
|
- ->condition('nid', 12242);
|
|
|
|
- // TODO: présentation nid should be a setting
|
|
|
|
|
|
+ ->condition('field_afficher_en_page_d_acceuil', 1)
|
|
|
|
+ ->condition('type', 'page');
|
|
|
|
|
|
- $pres_nid = $query->execute();
|
|
|
|
- $contents["#presentation_node"] = entity_load('node', array_pop($pres_nid));
|
|
|
|
|
|
+ $promoted_nids = $query->execute();
|
|
|
|
+ $contents["#promoted_nodes"] += entity_load_multiple('node', $promoted_nids);
|
|
|
|
+
|
|
|
|
+ // presentation
|
|
|
|
+ // $query = \Drupal::entityQuery('node')
|
|
|
|
+ // ->condition('status', 1)
|
|
|
|
+ // ->condition('nid', 12242);
|
|
|
|
+ // // TODO: présentation nid should be a setting
|
|
|
|
+ //
|
|
|
|
+ // $pres_nid = $query->execute();
|
|
|
|
+ // $contents["#presentation_node"] = entity_load('node', array_pop($pres_nid));
|
|
|
|
|
|
// last fil
|
|
// last fil
|
|
// $query = \Drupal::entityQuery('node')
|
|
// $query = \Drupal::entityQuery('node')
|
|
@@ -38,19 +56,19 @@ class HomeController extends ControllerBase {
|
|
//
|
|
//
|
|
// $fil = $query->execute();
|
|
// $fil = $query->execute();
|
|
// $contents["#last_fil_node"] = entity_load('node', array_pop($fil));
|
|
// $contents["#last_fil_node"] = entity_load('node', array_pop($fil));
|
|
- $contents["#last_fil_node"] = array('#markup'=>'En développement.');
|
|
|
|
|
|
+ // $contents["#last_fil_node"] = array('#markup'=>'En développement.');
|
|
|
|
|
|
|
|
|
|
// last production
|
|
// last production
|
|
- $query = \Drupal::entityQuery('node')
|
|
|
|
- ->condition('status', 1)
|
|
|
|
- ->condition('type', 'page')
|
|
|
|
- ->condition('field_page_type', array('1168'), 'NOT IN')
|
|
|
|
- ->sort('created', 'DESC')
|
|
|
|
- ->range(0,1);
|
|
|
|
-
|
|
|
|
- $prod = $query->execute();
|
|
|
|
- $contents["#last_production_node"] = entity_load('node', array_pop($prod));
|
|
|
|
|
|
+ // $query = \Drupal::entityQuery('node')
|
|
|
|
+ // ->condition('status', 1)
|
|
|
|
+ // ->condition('type', 'page')
|
|
|
|
+ // ->condition('field_page_type', array('1168'), 'NOT IN')
|
|
|
|
+ // ->sort('created', 'DESC')
|
|
|
|
+ // ->range(0,1);
|
|
|
|
+ //
|
|
|
|
+ // $prod = $query->execute();
|
|
|
|
+ // $contents["#last_production_node"] = entity_load('node', array_pop($prod));
|
|
|
|
|
|
// agenda
|
|
// agenda
|
|
$now = new DrupalDateTime('now');
|
|
$now = new DrupalDateTime('now');
|