public function ProductVariationListBuilder::__construct in Commerce Core 8.2
Constructs a new ProductVariationListBuilder object.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage.
\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.
\Drupal\Core\Form\FormBuilderInterface $form_builder: The form builder.
Overrides EntityListBuilder::__construct
File
- modules/
product/ src/ ProductVariationListBuilder.php, line 65
Class
- ProductVariationListBuilder
- Defines the list builder for product variations.
Namespace
Drupal\commerce_productCode
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityRepositoryInterface $entity_repository, RouteMatchInterface $route_match, FormBuilderInterface $form_builder) {
parent::__construct($entity_type, $storage);
$this->formBuilder = $form_builder;
$this->product = $route_match
->getParameter('commerce_product');
// The product might not be available when the list builder is
// instantiated by Views to build the list of operations.
if (!empty($this->product)) {
$this->product = $entity_repository
->getTranslationFromContext($this->product);
}
}