fixed home computed fields
This commit is contained in:
		@@ -42,8 +42,10 @@ class ComputedArticlesReferences extends EntityReferenceFieldItemList
 | 
			
		||||
        ->range(0,12)
 | 
			
		||||
        ->condition('type', 'article');
 | 
			
		||||
    $nids = $query->execute();
 | 
			
		||||
    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++;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,8 +42,10 @@ class ComputedCommerceProductReferences extends EntityReferenceFieldItemList
 | 
			
		||||
        // ->condition('type', 'article')
 | 
			
		||||
        ->range(0,12);
 | 
			
		||||
    $ids = $query->execute();
 | 
			
		||||
    foreach ($ids as $key => $id) {
 | 
			
		||||
      $this->list[$key] = $this->createItem($key, $id);
 | 
			
		||||
    $i = 0;
 | 
			
		||||
    foreach ($ids as $id) {
 | 
			
		||||
      $this->list[$i] = $this->createItem($i, $id);
 | 
			
		||||
      $i++;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -45,11 +45,13 @@ class ComputedShowroomsReferences extends EntityReferenceFieldItemList
 | 
			
		||||
 | 
			
		||||
    $tids = $query->execute();
 | 
			
		||||
    shuffle($tids);
 | 
			
		||||
    foreach ($tids as $key => $tid) {
 | 
			
		||||
    $i=0;
 | 
			
		||||
    foreach ($tids as $tid) {
 | 
			
		||||
      $term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($tid);
 | 
			
		||||
      $sid = WorkflowManager::getCurrentStateId($term, 'field_workflow');
 | 
			
		||||
      if($sid != 'workflow_visible') continue;
 | 
			
		||||
      $this->list[$key] = $this->createItem($key, $tid);
 | 
			
		||||
      $this->list[$i] = $this->createItem($i, $tid);
 | 
			
		||||
      $i++;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user