@@ -163,14 +163,27 @@ class CorpusController extends ControllerBase {
|
|||||||
->range(0,20);
|
->range(0,20);
|
||||||
|
|
||||||
$nids = $query->execute();
|
$nids = $query->execute();
|
||||||
|
$nodes = entity_load_multiple('node', $nids);
|
||||||
|
|
||||||
$this->lastdocs_nodes = entity_load_multiple('node', $nids);
|
// $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||||
|
|
||||||
// record an array of nids for corpus map filtering
|
$this->lastdocs_nodes = [];
|
||||||
$this->lastdocs_nids = [];
|
$this->lastdocs_nids = [];
|
||||||
foreach($nids as $key => $nid){
|
foreach ($nodes as $node) {
|
||||||
$this->lastdocs_nids[] = $nid;
|
// remove masqué
|
||||||
|
$sid = WorkflowManager::getCurrentStateId($node, 'field_workflow');
|
||||||
|
if($sid != 'corpus_documents_publie') continue;
|
||||||
|
|
||||||
|
$this->lastdocs_nodes[] = $node;
|
||||||
|
// record an array of nids for corpus map filtering
|
||||||
|
$this->lastdocs_nids[] = $node->get('nid')->getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// // record an array of nids for corpus map filtering
|
||||||
|
// $this->lastdocs_nids = [];
|
||||||
|
// foreach($nids as $key => $nid){
|
||||||
|
// $this->lastdocs_nids[] = $nid;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private function toRenderable(){
|
private function toRenderable(){
|
||||||
@@ -209,7 +222,7 @@ class CorpusController extends ControllerBase {
|
|||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'rendered'=> $rendered,
|
'rendered'=> $rendered,
|
||||||
'title'=>'Last Documents',
|
'title'=>t('Recently uploaded'),
|
||||||
'documents_lies' => $this->lastdocs_nids,
|
'documents_lies' => $this->lastdocs_nids,
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -232,7 +245,10 @@ class CorpusController extends ControllerBase {
|
|||||||
|
|
||||||
$data['#cache'] = [
|
$data['#cache'] = [
|
||||||
'max-age' => \Drupal\Core\Cache\Cache::PERMANENT,
|
'max-age' => \Drupal\Core\Cache\Cache::PERMANENT,
|
||||||
'tags' => ['edlp-lastdocs-cache']
|
'tags' => ['edlp-lastdocs-cache'],
|
||||||
|
'contexts' => [
|
||||||
|
'languages:language_content'
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
// $response = new JsonResponse();
|
// $response = new JsonResponse();
|
||||||
|
|||||||
Reference in New Issue
Block a user