You are here

GridStackFileFormatter.php in GridStack 8

Same filename and directory in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/GridStackFileFormatter.php

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;

/**
 * Plugin implementation of the 'GridStack' formatter to get ME within images.
 */
class GridStackFileFormatter extends GridStackFileFormatterBase {
  use GridStackFormatterTrait;
  use BlazyVideoTrait;

  /**
   * {@inheritdoc}
   */
  public function getScopedFormElements() {
    return [
      'fieldable_form' => TRUE,
      'multimedia' => TRUE,
      'view_mode' => $this->viewMode,
    ] + parent::getScopedFormElements();
  }

  /**
   * {@inheritdoc}
   */
  public static function isApplicable(FieldDefinitionInterface $field_definition) {
    $storage = $field_definition
      ->getFieldStorageDefinition();
    return $storage
      ->isMultiple() && $storage
      ->getSetting('target_type') === 'file';
  }

}

Classes

Namesort descending Description
GridStackFileFormatter Plugin implementation of the 'GridStack' formatter to get ME within images.