abstract class DashboardLazyBuildBase in Dashboards with Layout Builder 8
Same name and namespace in other branches
- 2.0.x src/Plugin/DashboardLazyBuildBase.php \Drupal\dashboards\Plugin\DashboardLazyBuildBase
Abstract class helper for lazy builds.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface- class \Drupal\dashboards\Plugin\DashboardBase implements ContainerFactoryPluginInterface, DashboardInterface uses StringTranslationTrait- class \Drupal\dashboards\Plugin\DashboardLazyBuildBase implements DashboardLazyBuildInterface
 
 
- class \Drupal\dashboards\Plugin\DashboardBase implements ContainerFactoryPluginInterface, DashboardInterface uses StringTranslationTrait
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\PluginView 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
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| DashboardBase:: | protected | property | Cache backend. | |
| DashboardBase:: | public | function | Build render array. | 9 | 
| DashboardBase:: | public static | function | Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: | 8 | 
| DashboardBase:: | protected | function | Get cache for cid. | |
| DashboardBase:: | public | function | Validate settings form. | |
| DashboardBase:: | protected | function | Set a new cache entry. Cache is prefixed by pluginid. | |
| DashboardBase:: | public | function | Validate settings form. | 1 | 
| DashboardBase:: | public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase:: | 8 | 
| DashboardLazyBuildBase:: | public | function | Build render array. Overrides DashboardBase:: | |
| DashboardLazyBuildBase:: | public static | function | Helper for lazy build render. Overrides DashboardLazyBuildInterface:: | |
| DashboardLazyBuildInterface:: | public static | function | Callback for lazy build. | 6 | 
| PluginBase:: | protected | property | Configuration information passed into the plugin. | 1 | 
| PluginBase:: | protected | property | The plugin implementation definition. | 1 | 
| PluginBase:: | protected | property | The plugin_id. | |
| PluginBase:: | constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
| PluginBase:: | public | function | Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: | |
| PluginBase:: | public | function | Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: | |
| PluginBase:: | public | function | Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: | 3 | 
| PluginBase:: | public | function | Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: | |
| PluginBase:: | public | function | Determines if the plugin is configurable. | |
| StringTranslationTrait:: | protected | property | The string translation service. | 1 | 
| StringTranslationTrait:: | protected | function | Formats a string containing a count of items. | |
| StringTranslationTrait:: | protected | function | Returns the number of plurals supported by a given language. | |
| StringTranslationTrait:: | protected | function | Gets the string translation service. | |
| StringTranslationTrait:: | public | function | Sets the string translation service to use. | 2 | 
| StringTranslationTrait:: | protected | function | Translates a string to the current language or to a given language. | 
