You are here

private function DibaCarousel::getItems in Diba carousel slider 8

Get the carousel items.

1 call to DibaCarousel::getItems()
DibaCarousel::build in src/Plugin/Block/DibaCarousel.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/DibaCarousel.php, line 878

Class

DibaCarousel
Provides a Diba carousel Block.

Namespace

Drupal\diba_carousel\Plugin\Block

Code

private function getItems($config) {
  $items = [];
  $entities = $this
    ->getQueriedEntities($config);
  if (!empty($entities)) {
    $langcode = $this->languageManager
      ->getCurrentLanguage()
      ->getId();
    foreach ($entities as $entity) {
      if ($entity
        ->access('view')) {
        if ($entity
          ->hasTranslation($langcode)) {
          $entity = $entity
            ->getTranslation($langcode);
        }
        $items[] = $this
          ->composeSlide($config, $entity);
      }
    }
  }
  return $items;
}