fixed thematiques display

This commit is contained in:
2021-03-03 17:55:32 +01:00
parent 72ea56e313
commit 6485e3e27b
8 changed files with 611 additions and 134 deletions

View File

@@ -107,7 +107,7 @@ class Base extends ControllerBase {
private function defaultQuery(){
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
$this->query = $entity_storage->getQuery()
->condition('type', 'materiau')
->condition('type', ['materiau', 'thematique'], 'IN')
->condition('status', '1')
->range($this->offset, $this->limit)
->accessCheck(TRUE)
@@ -116,7 +116,7 @@ class Base extends ControllerBase {
$this->results = $this->query->execute();
$this->count_query = $entity_storage->getQuery()
->condition('type', 'materiau')
->condition('type', ['materiau', 'thematique'], 'IN')
->accessCheck(TRUE)
->condition('status', '1')
->count();
@@ -191,18 +191,18 @@ class Base extends ControllerBase {
$nids = [];
// Using entityTypeManager
// Get a node storage object.
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
// $node_storage = \Drupal::entityTypeManager()->getStorage('node');
foreach ($this->results as $result) {
$lang = \Drupal::languageManager()->getCurrentLanguage()->getId();
// $lang = \Drupal::languageManager()->getCurrentLanguage()->getId();
// Load a single node.
$node = $node_storage->load($result);
// $node = $node_storage->load($result);
// check if has translation
if ($node->hasTranslation($lang)) {
// $uuids[] = $result->getField('uuid')->getValues()[0];
// i used to filter like bellow because of a graphql probleme
// if ($node->hasTranslation($lang)) {
$nids[] = $result;
}
// }
}
// $resp['uuids'] = $uuids;