You are here

public function TwitterWidgetFormatter::view in Twitter Profile Widget 8.2

Same name and namespace in other branches
  1. 3.x src/Plugin/Field/FieldFormatter/TwitterWidgetFormatter.php \Drupal\twitter_profile_widget\Plugin\Field\FieldFormatter\TwitterWidgetFormatter::view()

Builds a renderable array for a fully themed field.

Parameters

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

string $langcode: (optional) The language that should be used to render the field. Defaults to the current content language.

Return value

array A renderable array for a themed field with its label and all its values.

Overrides FormatterBase::view

File

src/Plugin/Field/FieldFormatter/TwitterWidgetFormatter.php, line 45

Class

TwitterWidgetFormatter
Plugin implementation of the 'twitter_widget' formatter.

Namespace

Drupal\twitter_profile_widget\Plugin\Field\FieldFormatter

Code

public function view(FieldItemListInterface $items, $langcode = NULL) {
  $elements = parent::view($items, $langcode);
  $elements['#cache']['tags'][] = 'twitter_profile_widget';
  return $elements;
}