You are here

public function PageContextService::__construct in Simple Facebook Pixel 8

PageContextService constructor.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config.

\Symfony\Component\HttpFoundation\RequestStack $request_stack: The request.

\Drupal\simple_facebook_pixel\PixelBuilderService $pixel_builder: The Pixel builder.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

File

src/PageContextService.php, line 80

Class

PageContextService
Class PageContextService.

Namespace

Drupal\simple_facebook_pixel

Code

public function __construct(ConfigFactoryInterface $config_factory, RequestStack $request_stack, PixelBuilderService $pixel_builder, EntityTypeManagerInterface $entity_type_manager) {
  $this->configFactory = $config_factory
    ->get('simple_facebook_pixel.settings');
  $this->request = $request_stack
    ->getCurrentRequest();
  $this->pixelBuilder = $pixel_builder;
  $this->entityTypeManager = $entity_type_manager;
  if (\Drupal::hasService('commerce_store.current_store') && \Drupal::hasService('commerce_price.chain_price_resolver') && \Drupal::hasService('current_user')) {
    $this->currentStore = \Drupal::service('commerce_store.current_store');
    $this->chainPriceResolver = \Drupal::service('commerce_price.chain_price_resolver');
    $this->currentUser = \Drupal::service('current_user');
  }
}