You are here

class SlickFileFormatter in Slick Carousel 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/SlickFileFormatter.php \Drupal\slick\Plugin\Field\FieldFormatter\SlickFileFormatter
  2. 7.3 src/Plugin/Field/FieldFormatter/SlickFileFormatter.php \Drupal\slick\Plugin\Field\FieldFormatter\SlickFileFormatter

Plugin implementation of the 'Slick File' formatter to get ME within images.

This is not 'Slick Media', instead a simple mix of image and optional video.

Hierarchy

Expanded class hierarchy of SlickFileFormatter

File

src/Plugin/Field/FieldFormatter/SlickFileFormatter.php, line 13

Namespace

Drupal\slick\Plugin\Field\FieldFormatter
View source
class SlickFileFormatter extends SlickFileFormatterBase {
  use SlickFormatterTrait;
  use BlazyVideoTrait;

  /**
   * {@inheritdoc}
   */
  public function buildSettings() {
    return [
      'blazy' => TRUE,
    ] + parent::getSettings();
  }

  /**
   * {@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';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SlickFileFormatter::buildSettings public function
SlickFileFormatter::getScopedFormElements public function Overrides SlickFileFormatterBase::getScopedFormElements
SlickFileFormatter::isApplicable public static function Overrides SlickFormatterTrait::isApplicable
SlickFileFormatterBase::buildElements public function Build the slick carousel elements.
SlickFileFormatterBase::create public static function
SlickFileFormatterBase::defaultSettings public static function
SlickFileFormatterBase::viewElements public function
SlickFileFormatterBase::__construct public function Constructs a SlickImageFormatter instance.
SlickFormatterTrait::$formatter protected property The slick field formatter manager.
SlickFormatterTrait::$manager protected property The slick field formatter manager.
SlickFormatterTrait::admin public function Returns the slick admin service shortcut.
SlickFormatterTrait::formatter public function Returns the slick field formatter service.
SlickFormatterTrait::manager public function Returns the slick service.
SlickFormatterTrait::settingsSummary public function