You are here

interface BlazyManagerInterface in Blazy 8.2

Same name and namespace in other branches
  1. 8 src/BlazyManagerInterface.php \Drupal\blazy\BlazyManagerInterface
  2. 7 src/BlazyManagerInterface.php \Drupal\blazy\BlazyManagerInterface

Defines re-usable services and functions for blazy plugins.

Hierarchy

Expanded class hierarchy of BlazyManagerInterface

All classes that implement BlazyManagerInterface

5 files declare their use of BlazyManagerInterface
BlazyAdminBase.php in src/Form/BlazyAdminBase.php
BlazyAdminTest.php in tests/modules/blazy_test/src/Form/BlazyAdminTest.php
BlazyStylePluginBase.php in src/Dejavu/BlazyStylePluginBase.php
BlazyViews.php in src/Plugin/views/style/BlazyViews.php
BlazyViewsFieldPluginBase.php in src/Plugin/views/field/BlazyViewsFieldPluginBase.php

File

src/BlazyManagerInterface.php, line 8

Namespace

Drupal\blazy
View source
interface BlazyManagerInterface {

  /**
   * Returns array of needed assets suitable for #attached property.
   *
   * @param array $attach
   *   The settings which determine what library to attach.
   *
   * @return array
   *   The supported libraries.
   */
  public function attach(array $attach = []);

  /**
   * Returns drupalSettings for IO.
   *
   * @param array $attach
   *   The settings which determine what library to attach.
   *
   * @return array
   *   The supported IO drupalSettings.
   */
  public function getIoSettings(array $attach = []);

  /**
   * Gets the supported lightboxes.
   *
   * @return array
   *   The supported lightboxes.
   */
  public function getLightboxes();

  /**
   * Returns the supported image effects.
   *
   * @return array
   *   The supported image effects.
   */
  public function getImageEffects();

  /**
   * Checks for Blazy formatter such as from within a Views style plugin.
   *
   * Ensures the settings traverse up to the container where Blazy is clueless.
   * The supported plugins can add [data-blazy] attribute into its container
   * containing $settings['blazy_data'] converted into [data-blazy] JSON.
   * This allows Blazy Grid, or other Views styles, lacking of UI, to have
   * additional settings extracted from the first Blazy formatter found.
   * Such as media switch/ lightbox. This way the container can add relevant
   * attributes to its container, etc. Also applies to entity references where
   * Blazy is not the main formatter, instead embedded as part of the parent's.
   *
   * This fairly complex logic is intended to reduce similarly complex logic at
   * individual item. But rather than at individual item, it is executed once
   * at the container level. If you have 100 images, this method is executed
   * once, not 100x, as long as you have all image styles cropped, not scaled.
   *
   * This still needs improvements and a little more simplified version.
   *
   * @param array $settings
   *   The settings being modified.
   * @param array $item
   *   The first item containing settings or item keys.
   *
   * @see \Drupal\blazy\BlazyManager::prepareBuild()
   * @see \Drupal\blazy\Dejavu\BlazyEntityBase::buildElements()
   */
  public function isBlazy(array &$settings, array $item = []);

}

Members

Namesort descending Modifiers Type Description Overrides
BlazyManagerInterface::attach public function Returns array of needed assets suitable for #attached property. 1
BlazyManagerInterface::getImageEffects public function Returns the supported image effects. 1
BlazyManagerInterface::getIoSettings public function Returns drupalSettings for IO. 1
BlazyManagerInterface::getLightboxes public function Gets the supported lightboxes. 1
BlazyManagerInterface::isBlazy public function Checks for Blazy formatter such as from within a Views style plugin. 1