You are here

public function ElementLinkClassTrait::viewElements in Element Class Formatter 8

File

src/Plugin/Field/FieldFormatter/ElementLinkClassTrait.php, line 47

Class

ElementLinkClassTrait
The ElementLinkClassTrait is used to add a class to a field which .

Namespace

Drupal\element_class_formatter\Plugin\Field\FieldFormatter

Code

public function viewElements(FieldItemListInterface $items, $langcode) {
  $elements = parent::viewElements($items, $langcode);
  $class = $this
    ->getSetting('class');
  return $this
    ->setElementClass($elements, $class, $items);
}