public function MagnificPopup::view in Magnific Popup 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/MagnificPopup.php \Drupal\magnific_popup\Plugin\Field\FieldFormatter\MagnificPopup::view()
Overrides EntityReferenceFormatterBase::view
See also
::prepareView()
::getEntitiestoView()
File
- src/
Plugin/ Field/ FieldFormatter/ MagnificPopup.php, line 141
Class
- MagnificPopup
- Magnific Popup field formatter.
Namespace
Drupal\magnific_popup\Plugin\Field\FieldFormatterCode
public function view(FieldItemListInterface $items, $langcode = NULL) {
$elements = parent::view($items, $langcode);
$gallery_type = $this
->getSetting('gallery_type');
$vertical_fit = $this
->getSetting('vertical_fit');
$elements['#attributes']['class'][] = 'mfp-field';
$elements['#attributes']['class'][] = 'mfp-' . Html::cleanCssIdentifier($gallery_type);
$elements['#attributes']['data-vertical-fit'][] = "{$vertical_fit}";
return $elements;
}