trait PreWarmablePluginManagerTrait

Provides a trait for Drupal\Core\PreWarm\PreWarmableInterface.

For the vast majority of plugin managers, the ::getDefinitions() method does exactly the right logic for cache prewarming, so this provides a default implementation that uses that.

@phpstan-require-implements \Drupal\Component\Plugin\Discovery\DiscoveryInterface @phpstan-require-implements \Drupal\Core\PreWarm\PreWarmableInterface

Hierarchy

3 files declare their use of PreWarmablePluginManagerTrait
ElementInfoManager.php in core/lib/Drupal/Core/Render/ElementInfoManager.php
ViewsHandlerManager.php in core/modules/views/src/Plugin/ViewsHandlerManager.php
ViewsPluginManager.php in core/modules/views/src/Plugin/ViewsPluginManager.php

File

core/lib/Drupal/Core/Plugin/PreWarmablePluginManagerTrait.php, line 15

Namespace

Drupal\Core\Plugin
View source
trait PreWarmablePluginManagerTrait {
    
    /**
     * Implements \Drupal\Core\PreWarm\PreWarmableInterface.
     */
    public function preWarm() : void {
        $this->getDefinitions();
    }

}

Members

Title Sort descending Modifiers Object type Summary
PreWarmablePluginManagerTrait::preWarm public function Implements \Drupal\Core\PreWarm\PreWarmableInterface.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.