You are here

public function SlickFileFormatterBase::viewElements in Slick Carousel 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/SlickFileFormatterBase.php \Drupal\slick\Plugin\Field\FieldFormatter\SlickFileFormatterBase::viewElements()

File

src/Plugin/Field/FieldFormatter/SlickFileFormatterBase.php, line 37

Class

SlickFileFormatterBase
Base class for slick image and file ER formatters.

Namespace

Drupal\slick\Plugin\Field\FieldFormatter

Code

public function viewElements(FieldItemListInterface $items, $langcode) {
  $entities = $this
    ->getEntitiesToView($items, $langcode);

  // Early opt-out if the field is empty.
  if (empty($entities)) {
    return [];
  }
  return $this
    ->commonViewElements($items, $langcode, $entities);
}