You are here

public static function AddToCartController::create in Commerce Add To Cart Link 8

Same name and namespace in other branches
  1. 2.x src/Controller/AddToCartController.php \Drupal\commerce_add_to_cart_link\Controller\AddToCartController::create()

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Overrides ControllerBase::create

File

src/Controller/AddToCartController.php, line 107

Class

AddToCartController
Defines the add to cart controller.

Namespace

Drupal\commerce_add_to_cart_link\Controller

Code

public static function create(ContainerInterface $container) {
  return new static($container
    ->get('commerce_add_to_cart_link.token'), $container
    ->get('commerce_cart.cart_manager'), $container
    ->get('commerce_cart.cart_provider'), $container
    ->get('commerce_order.chain_order_type_resolver'), $container
    ->get('commerce_store.current_store'), $container
    ->get('commerce_price.chain_price_resolver'), $container
    ->get('current_user'));
}