fixed unpublished lastdocs showup #462

This commit is contained in:
2019-03-19 12:14:01 +01:00
parent fa394afc11
commit c2b20e5e75
@@ -83,9 +83,19 @@ class HomeController extends ControllerBase {
->condition('status', 1)
->condition('type', 'enregistrement')
->sort('created', 'DESC')
->range(0,10);
->range(0,50);
$lastdocs = $query->execute();
$nodes = $query->execute();
$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);
// dsm($contents["#lastdocs_items"], "#lastdocs_items");