public function GridStackEntityFormatterBase::viewElements in GridStack 8.2
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldFormatter/GridStackEntityFormatterBase.php \Drupal\gridstack\Plugin\Field\FieldFormatter\GridStackEntityFormatterBase::viewElements()
File
- src/
Plugin/ Field/ FieldFormatter/ GridStackEntityFormatterBase.php, line 54
Class
- GridStackEntityFormatterBase
- Base class for gridstack entity reference formatters without field details.
Namespace
Drupal\gridstack\Plugin\Field\FieldFormatterCode
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);
}