GridStackFileFormatter.php in GridStack 8
File
src/Plugin/Field/FieldFormatter/GridStackFileFormatter.php
View source
<?php
namespace Drupal\gridstack\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\blazy\Dejavu\BlazyVideoTrait;
class GridStackFileFormatter extends GridStackFileFormatterBase {
use GridStackFormatterTrait;
use BlazyVideoTrait;
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';
}
}