You are here

BlazyFormatterBaseTrait.php in Blazy 8

File

src/Plugin/Field/FieldFormatter/BlazyFormatterBaseTrait.php
View source
<?php

namespace Drupal\blazy\Plugin\Field\FieldFormatter;


/**
 * A Trait common for blazy image, video and file ER formatters.
 */
trait BlazyFormatterBaseTrait {

  /**
   * The blazy manager service.
   *
   * @var \Drupal\blazy\BlazyFormatterManager
   */
  protected $blazyManager;

  /**
   * Returns the blazy manager.
   */
  public function blazyManager() {
    return $this->blazyManager;
  }

  /**
   * Builds the settings.
   */
  public function buildSettings() {
    $settings = $this
      ->getSettings();
    $settings['plugin_id'] = $this
      ->getPluginId();
    return $settings;
  }

  /**
   * Returns the blazy admin service.
   */
  public function admin() {
    return \Drupal::service('blazy.admin.formatter');
  }

  /**
   * {@inheritdoc}
   */
  public function settingsSummary() {
    return $this
      ->admin()
      ->getSettingsSummary($this
      ->getScopedFormElements());
  }

}

Traits

Namesort descending Description
BlazyFormatterBaseTrait A Trait common for blazy image, video and file ER formatters.