You are here

trait BlazyFormatterBaseTrait in Blazy 8

A Trait common for blazy image, video and file ER formatters.

Hierarchy

1 file declares its use of BlazyFormatterBaseTrait
BlazyTestEntityReferenceFormatterTest.php in tests/modules/blazy_test/src/Plugin/Field/FieldFormatter/BlazyTestEntityReferenceFormatterTest.php

File

src/Plugin/Field/FieldFormatter/BlazyFormatterBaseTrait.php, line 8

Namespace

Drupal\blazy\Plugin\Field\FieldFormatter
View source
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());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlazyFormatterBaseTrait::$blazyManager protected property The blazy manager service.
BlazyFormatterBaseTrait::admin public function Returns the blazy admin service. 1
BlazyFormatterBaseTrait::blazyManager public function Returns the blazy manager.
BlazyFormatterBaseTrait::buildSettings public function Builds the settings. 1
BlazyFormatterBaseTrait::settingsSummary public function