protected function FlippingBookIframeFormatter::viewValue in Flipping Book 8
Generate the output appropriate for one field item.
Parameters
\Drupal\Core\Field\FieldItemInterface $item: One field item.
Return value
string The textual output generated.
1 call to FlippingBookIframeFormatter::viewValue()
- FlippingBookIframeFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ FlippingBookIframeFormatter.php - Builds a renderable array for a field value.
File
- src/
Plugin/ Field/ FieldFormatter/ FlippingBookIframeFormatter.php, line 104
Class
- FlippingBookIframeFormatter
- Plugin implementation of the 'flipping_book_iframe_formatter' formatter.
Namespace
Drupal\flipping_book\Plugin\Field\FieldFormatterCode
protected function viewValue(FieldItemInterface $item) {
$value = $item
->getValue();
if (empty($value['target_id'])) {
return NULL;
}
$flipping_book = $item
->getRoot()
->getValue();
$settings = $this
->getSettings();
$url = \Drupal::service('flipping_book')
->buildFlippingBookUrl($flipping_book)
->toUriString();
return '<iframe class="' . $settings['class'] . '" width="' . $settings['width'] . '" height="' . $settings['height'] . '" src="' . $url . '" frameborder="0" allowfullscreen></iframe>';
}