BlazyViewsFieldMedia.php in Blazy 8
File
src/Plugin/views/field/BlazyViewsFieldMedia.php
View source
<?php
namespace Drupal\blazy\Plugin\views\field;
use Drupal\views\ResultRow;
class BlazyViewsFieldMedia extends BlazyViewsFieldPluginBase {
public function render(ResultRow $values) {
$media = $values->_entity;
$data['settings'] = $this
->mergedViewsSettings();
$data['settings']['delta'] = $values->index;
return $this
->buildPreview($data, $media, $media
->label());
}
public function getScopedFormElements() {
return [
'multimedia' => TRUE,
'view_mode' => 'default',
] + parent::getScopedFormElements();
}
}