public static function ResourceWarmer::create in JSON:API Boost 8
Same name and namespace in other branches
- 2.x src/Plugin/warmer/ResourceWarmer.php \Drupal\jsonapi_boost\Plugin\warmer\ResourceWarmer::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 WarmerPluginBase::create
File
- src/
Plugin/ warmer/ ResourceWarmer.php, line 58
Class
- ResourceWarmer
- Warms JSON:API resources.
Namespace
Drupal\jsonapi_boost\Plugin\warmerCode
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
/** @var \Drupal\jsonapi_boost\Plugin\warmer\ResourceWarmer $instance */
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$instance
->setEntityTypeManager($container
->get('entity_type.manager'));
$instance
->setResourceTypeRepository($container
->get('jsonapi.resource_type.repository'));
$instance
->setEntityToJsonapi($container
->get('jsonapi_extras.entity.to_jsonapi'));
return $instance;
}