trying to fix the bad content type coming on home materials cards grid

This commit is contained in:
Bachir Soussi Chiadmi 2021-07-28 15:02:50 +02:00
parent ba5ddc9cec
commit f2eb90d888
1 changed files with 5 additions and 3 deletions

View File

@ -41,14 +41,16 @@ class ComputedMaterialsReferences extends EntityReferenceFieldItemList
->condition('status', 1)
->condition('type', 'materiau')
->exists('field_materiau_images')
->condition('field_materiau_images.%delta', 3)
->condition('field_materiau_images.%delta', 3, '>')
->sort('created', 'DESC')
->range(0,200);
$results = $query->execute();
if ($results) {
$nids = array_rand($results, 100);
foreach ($nids as $key => $nid) {
$this->list[$key] = $this->createItem($key, $nid);
$i = 0;
foreach ($nids as $nid) {
$this->list[$i] = $this->createItem($i, $nid);
$i++;
}
}
}