BlazyViewsFieldFile.php in Blazy 7
File
src/Plugin/views/field/BlazyViewsFieldFile.php
View source
<?php
namespace Drupal\blazy\Plugin\views\field;
class BlazyViewsFieldFile extends BlazyViewsFieldPluginBase {
public function render($values) {
$fid = $values->fid;
$entity = file_load($fid);
$settings = $this
->mergedViewsSettings();
$settings['delta'] = $this->view->row_index;
$settings['entity_type_id'] = 'file';
$settings['uri'] = $entity->uri;
$data = $this
->getImageItem($entity);
$data['settings'] = isset($data['settings']) ? array_merge($settings, $data['settings']) : $settings;
return $this
->blazyEntity()
->build($data, $entity);
}
public function getScopedFormElements() {
return [
'multimedia' => TRUE,
'view_mode' => 'default',
] + parent::getScopedFormElements();
}
}