Version 1
[yaffs-website] / web / modules / contrib / blazy / src / Plugin / Field / FieldFormatter / BlazyFileFormatter.php
1 <?php
2
3 namespace Drupal\blazy\Plugin\Field\FieldFormatter;
4
5 use Drupal\Core\Field\FieldDefinitionInterface;
6 use Drupal\blazy\Dejavu\BlazyVideoTrait;
7
8 /**
9  * Plugin implementation of the 'Blazy File' to get videos within images/files.
10  */
11 class BlazyFileFormatter extends BlazyFileFormatterBase {
12
13   use BlazyFormatterTrait;
14   use BlazyVideoTrait;
15
16   /**
17    * {@inheritdoc}
18    */
19   public function getScopedFormElements() {
20     return [
21       'fieldable_form' => TRUE,
22       'multimedia'     => TRUE,
23       'view_mode'      => $this->viewMode,
24     ] + parent::getScopedFormElements();
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public static function isApplicable(FieldDefinitionInterface $field_definition) {
31     return $field_definition->getFieldStorageDefinition()->getSetting('target_type') === 'file';
32   }
33
34 }