2 Commits fa394afc11 ... 1e009f88bf

Author SHA1 Message Date
  Bachir Soussi Chiadmi 1e009f88bf fixed bug #462 5 years ago
  Bachir Soussi Chiadmi c2b20e5e75 fixed unpublished lastdocs showup #462 5 years ago
1 changed files with 17 additions and 4 deletions
  1. 17 4
      sites/all/modules/figli/edlp_home/src/Controller/HomeController.php

+ 17 - 4
sites/all/modules/figli/edlp_home/src/Controller/HomeController.php

@@ -83,10 +83,23 @@ class HomeController extends ControllerBase {
       ->condition('status', 1)
       ->condition('type', 'enregistrement')
       ->sort('created', 'DESC')
-      ->range(0,10);
-
-    $lastdocs = $query->execute();
-    $contents["#lastdocs_items"] = entity_load_multiple('node', $lastdocs);
+      ->range(0,50);
+
+    $nids = $query->execute();
+    $nodes = entity_load_multiple('node', $nids);
+
+    $lastdocs = [];
+    $i = 0;
+    foreach ($nodes as $node) {
+      // remove masqué
+      $sid = WorkflowManager::getCurrentStateId($node, 'field_workflow');
+      if($sid != 'corpus_documents_publie') continue;
+      $lastdocs[] = $node;
+      $i++;
+      if($i>9) break;
+    }
+    // $contents["#lastdocs_items"] = entity_load_multiple('node', $lastdocs);
+    $contents["#lastdocs_items"] = $lastdocs;
     // dsm($contents["#lastdocs_items"], "#lastdocs_items");
 
     // agenda