You are here

public static function JuiceboxFieldFormatter::create in Juicebox HTML5 Responsive Image Galleries 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/JuiceboxFieldFormatter.php \Drupal\juicebox\Plugin\Field\FieldFormatter\JuiceboxFieldFormatter::create()

Factory to fetch required dependencies from container.

Overrides FormatterBase::create

File

src/Plugin/Field/FieldFormatter/JuiceboxFieldFormatter.php, line 84

Class

JuiceboxFieldFormatter
Plugin implementation of the 'juicebox' formatter.

Namespace

Drupal\juicebox\Plugin\Field\FieldFormatter

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {

  // Create a new instance of the plugin. This also allows us to extract
  // services from the container and inject them into our plugin via its own
  // constructor as needed.
  return new static($configuration, $plugin_id, $plugin_definition, $container
    ->get('entity.manager'), $container
    ->get('link_generator'), $container
    ->get('request_stack'), $container
    ->get('juicebox.formatter'), $container
    ->get('renderer'));
}