protected static function SlickFormatterTrait::injectServices in Slick Carousel 8.2
Injects DI services.
5 calls to SlickFormatterTrait::injectServices()
- SlickEntityFormatterBase::create in src/
Plugin/ Field/ FieldFormatter/ SlickEntityFormatterBase.php - Creates an instance of the plugin.
- SlickEntityReferenceFormatterBase::create in src/
Plugin/ Field/ FieldFormatter/ SlickEntityReferenceFormatterBase.php - Creates an instance of the plugin.
- SlickFileFormatter::create in src/
Plugin/ Field/ FieldFormatter/ SlickFileFormatter.php - SlickFileFormatterBase::create in src/
Plugin/ Field/ FieldFormatter/ SlickFileFormatterBase.php - SlickTextFormatter::create in src/
Plugin/ Field/ FieldFormatter/ SlickTextFormatter.php - Creates an instance of the plugin.
File
- src/
Plugin/ Field/ FieldFormatter/ SlickFormatterTrait.php, line 65
Class
- SlickFormatterTrait
- A Trait common for slick formatters.
Namespace
Drupal\slick\Plugin\Field\FieldFormatterCode
protected static function injectServices($instance, ContainerInterface $container, $type = '') {
$instance->formatter = $instance->blazyManager = $container
->get('slick.formatter');
$instance->manager = $container
->get('slick.manager');
// Blazy:2.x+ might already set these, provides a failsafe.
if ($type == 'image' || $type == 'entity') {
$instance->imageFactory = isset($instance->imageFactory) ? $instance->imageFactory : $container
->get('image.factory');
if ($type == 'entity') {
$instance->loggerFactory = isset($instance->loggerFactory) ? $instance->loggerFactory : $container
->get('logger.factory');
$instance->blazyEntity = isset($instance->blazyEntity) ? $instance->blazyEntity : $container
->get('blazy.entity');
$instance->blazyOembed = isset($instance->blazyOembed) ? $instance->blazyOembed : $instance->blazyEntity
->oembed();
}
}
return $instance;
}