You are here

public function FlickityEntityView::viewElements in Flickity Carousel 8

Same name and namespace in other branches
  1. 8.2 modules/fields/src/Plugin/Field/FieldFormatter/FlickityEntityView.php \Drupal\flickity_fields\Plugin\Field\FieldFormatter\FlickityEntityView::viewElements()
  2. 3.0.x modules/fields/src/Plugin/Field/FieldFormatter/FlickityEntityView.php \Drupal\flickity_fields\Plugin\Field\FieldFormatter\FlickityEntityView::viewElements()

Builds a renderable array for a field value.

Parameters

\Drupal\Core\Field\FieldItemListInterface $items: The field values to be rendered.

string $langcode: The language that should be used to render the field.

Return value

array A renderable array for $items, as an array of child elements keyed by consecutive numeric indexes starting from 0.

Overrides EntityReferenceEntityFormatter::viewElements

File

modules/fields/src/Plugin/Field/FieldFormatter/FlickityEntityView.php, line 62
Contains \Drupal\flickity_fields\Plugin\Field\FieldFormatter\FlickityEntityView

Class

FlickityEntityView
Plugin implementation of the 'flickity entity view' formatter.

Namespace

Drupal\flickity_fields\Plugin\Field\FieldFormatter

Code

public function viewElements(FieldItemListInterface $items, $langcode) {
  $elements = array(
    '#theme' => 'flickity_entity_view',
    '#children' => parent::viewElements($items, $langcode),
    '#settings' => $this
      ->getSetting('flickity_settings'),
    '#title' => $this->fieldDefinition
      ->getLabel(),
    '#label_display' => $this->label,
  );
  return $elements;
}