You are here

abstract class DashboardLazyBuildBase in Dashboards with Layout Builder 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/DashboardLazyBuildBase.php \Drupal\dashboards\Plugin\DashboardLazyBuildBase

Abstract class helper for lazy builds.

Hierarchy

Expanded class hierarchy of DashboardLazyBuildBase

2 files declare their use of DashboardLazyBuildBase
MatomoBase.php in modules/dashboards_matomo/src/Plugin/Dashboard/MatomoBase.php
RssNews.php in src/Plugin/Dashboard/RssNews.php

File

src/Plugin/DashboardLazyBuildBase.php, line 10

Namespace

Drupal\dashboards\Plugin
View source
abstract class DashboardLazyBuildBase extends DashboardBase implements DashboardLazyBuildInterface {

  /**
   * {@inheritdoc}
   */
  public static function lazyBuildPreRender(string $pluginId, string $configuration) : array {
    $configuration = Json::decode($configuration);
    $plugin = \Drupal::service('plugin.manager.dashboard')
      ->createInstance($pluginId, $configuration);
    return static::lazyBuild($plugin, $configuration);
  }

  /**
   * {@inheritdoc}
   */
  public function buildRenderArray($configuration) : array {
    return [
      '#lazy_builder' => [
        static::class . '::lazyBuildPreRender',
        [
          $this
            ->getPluginId(),
          Json::encode($configuration),
        ],
      ],
      '#create_placeholder' => TRUE,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DashboardBase::$cache protected property Cache backend.
DashboardBase::buildSettingsForm public function Build render array. 9
DashboardBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 8
DashboardBase::getCache protected function Get cache for cid.
DashboardBase::massageFormValues public function Validate settings form.
DashboardBase::setCache protected function Set a new cache entry. Cache is prefixed by pluginid.
DashboardBase::validateForm public function Validate settings form. 1
DashboardBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct 8
DashboardLazyBuildBase::buildRenderArray public function Build render array. Overrides DashboardBase::buildRenderArray
DashboardLazyBuildBase::lazyBuildPreRender public static function Helper for lazy build render. Overrides DashboardLazyBuildInterface::lazyBuildPreRender
DashboardLazyBuildInterface::lazyBuild public static function Callback for lazy build. 6
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.