You are here

public function ParagraphsGridFormatter::view in Paragraphs grid 8

Overrides EntityReferenceFormatterBase::view

See also

::prepareView()

::getEntitiestoView()

File

src/Plugin/Field/FieldFormatter/ParagraphsGridFormatter.php, line 128

Class

ParagraphsGridFormatter
Plugin implementation of the 'entity reference rendered entity' formatter.

Namespace

Drupal\paragraphs_grid\Plugin\Field\FieldFormatter

Code

public function view(FieldItemListInterface $items, $langcode = NULL) {
  $elements = parent::view($items, $langcode);
  if ($this
    ->getSetting('container') !== 'none') {
    $elements['#container_attributes'] = new Attribute([
      'class' => [
        $this
          ->getSetting('container'),
      ],
    ]);
  }
  return $elements;
}