You are here

public static function WarmerPluginBase::create in Warmer 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/WarmerPluginBase.php \Drupal\warmer\Plugin\WarmerPluginBase::create()

Creates an instance of the plugin.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The container to pull out services used in the plugin.

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Return value

static Returns an instance of this plugin.

Overrides ContainerFactoryPluginInterface::create

3 calls to WarmerPluginBase::create()
CdnWarmer::create in modules/warmer_cdn/src/Plugin/warmer/CdnWarmer.php
Creates an instance of the plugin.
EntityWarmer::create in modules/warmer_entity/src/Plugin/warmer/EntityWarmer.php
Creates an instance of the plugin.
SitemapWarmer::create in modules/warmer_cdn/src/Plugin/warmer/SitemapWarmer.php
3 methods override WarmerPluginBase::create()
CdnWarmer::create in modules/warmer_cdn/src/Plugin/warmer/CdnWarmer.php
Creates an instance of the plugin.
EntityWarmer::create in modules/warmer_entity/src/Plugin/warmer/EntityWarmer.php
Creates an instance of the plugin.
SitemapWarmer::create in modules/warmer_cdn/src/Plugin/warmer/SitemapWarmer.php

File

src/Plugin/WarmerPluginBase.php, line 53

Class

WarmerPluginBase
Base class for warmer plugins that implement settings forms.

Namespace

Drupal\warmer\Plugin

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  $settings = $container
    ->get('config.factory')
    ->get('warmer.settings')
    ->get('warmers');
  $plugin_settings = empty($settings[$plugin_id]) ? [] : $settings[$plugin_id];
  $configuration = array_merge($plugin_settings, $configuration);
  return new static($configuration, $plugin_id, $plugin_definition, $container
    ->get('state'), $container
    ->get('datetime.time'));
}