You are here

trait BlazyManagerTrait in Blazy 7

A Trait common for blazy-related plugins.

Provides objects which cannot be instatiated with a DI for when the classes are instantiated/ locked within procedural functions such as Views hooks.

Hierarchy

2 files declare their use of BlazyManagerTrait
BlazyViews.php in src/Plugin/views/style/BlazyViews.php
BlazyViewsFieldPluginBase.php in src/Plugin/views/field/BlazyViewsFieldPluginBase.php

File

src/BlazyManagerTrait.php, line 11

Namespace

Drupal\blazy
View source
trait BlazyManagerTrait {

  /**
   * The blazy library service.
   *
   * @var \Drupal\blazy\BlazyLibrary
   */
  protected $library;

  /**
   * The blazy formatter service.
   *
   * @var \Drupal\blazy\BlazyFormatter
   */
  protected $formatter;

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

  /**
   * Returns the blazy manager.
   */
  public function formatter() {
    if (!isset($this->formatter)) {
      $this->formatter = new BlazyFormatter();
    }
    return $this->formatter;
  }

  /**
   * Returns the blazy manager.
   */
  public function manager() {
    if (!isset($this->manager)) {
      $this->manager = new BlazyManager();
    }
    return $this->manager;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlazyManagerTrait::$formatter protected property The blazy formatter service.
BlazyManagerTrait::$library protected property The blazy library service.
BlazyManagerTrait::$manager protected property The blazy manager service.
BlazyManagerTrait::formatter public function Returns the blazy manager.
BlazyManagerTrait::manager public function Returns the blazy manager.