BlazyViewsFieldFile.php in Blazy 8.2
File
src/Plugin/views/field/BlazyViewsFieldFile.php
View source
<?php
namespace Drupal\blazy\Plugin\views\field;
use Drupal\views\ResultRow;
class BlazyViewsFieldFile extends BlazyViewsFieldPluginBase {
public function render(ResultRow $values) {
$entity = $values->_entity;
$settings = $this
->mergedViewsSettings();
$settings['delta'] = $values->index;
$settings['entity_id'] = $entity
->id();
$settings['bundle'] = $entity
->bundle();
$settings['entity_type_id'] = $entity
->getEntityTypeId();
$data = $this->blazyEntity
->oembed()
->getImageItem($entity);
$data['settings'] = isset($data['settings']) ? array_merge($settings, $data['settings']) : $settings;
$this->mergedSettings = $data['settings'];
return $this->blazyEntity
->build($data, $entity, $entity
->getFilename());
}
public function getScopedFormElements() {
return [
'multimedia' => TRUE,
'view_mode' => 'default',
] + parent::getScopedFormElements();
}
}