public static function SitemapWarmer::create in Warmer 8
Same name and namespace in other branches
- 2.x modules/warmer_cdn/src/Plugin/warmer/SitemapWarmer.php \Drupal\warmer_cdn\Plugin\warmer\SitemapWarmer::create()
Throws
\Drupal\Component\Plugin\Exception\PluginException
Overrides WarmerPluginBase::create
File
- modules/
warmer_cdn/ src/ Plugin/ warmer/ SitemapWarmer.php, line 61
Class
- SitemapWarmer
- The cache warmer for the built-in entity cache.
Namespace
Drupal\warmer_cdn\Plugin\warmerCode
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
assert($instance instanceof SitemapWarmer);
// Inject options to sitemap parser.
$instance_configuration = $instance
->getConfiguration();
$sitemap_parser_options = [
'guzzle' => [
'verify' => $instance_configuration['verify'],
],
];
$factory = $container
->get('warmer_cdn.sitemap_parser.factory');
assert($factory instanceof SitemapParserFactory);
$parser = $factory
->get(SitemapParser::DEFAULT_USER_AGENT, $sitemap_parser_options);
$instance
->setSitemapParser($parser);
$warmer_manager = $container
->get('plugin.manager.warmer');
assert($warmer_manager instanceof WarmerPluginManager);
$instance
->setWarmerManager($warmer_manager);
return $instance;
}