SlickFileFormatter.php in Slick Carousel 8
File
src/Plugin/Field/FieldFormatter/SlickFileFormatter.php
View source
<?php
namespace Drupal\slick\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\blazy\Dejavu\BlazyVideoTrait;
class SlickFileFormatter extends SlickFileFormatterBase {
use SlickFormatterTrait;
use BlazyVideoTrait;
public function buildSettings() {
return [
'blazy' => TRUE,
] + parent::getSettings();
}
public function getScopedFormElements() {
return [
'fieldable_form' => TRUE,
'multimedia' => TRUE,
'view_mode' => $this->viewMode,
] + parent::getScopedFormElements();
}
public static function isApplicable(FieldDefinitionInterface $field_definition) {
$storage = $field_definition
->getFieldStorageDefinition();
return $storage
->isMultiple() && $storage
->getSetting('target_type') === 'file';
}
}
Classes
Name |
Description |
SlickFileFormatter |
Plugin implementation of the 'Slick File' formatter to get ME within images. |