You are here

public function Tracker::__construct in Menu Entity Index 8

Constructs the Tracker object.

Parameters

\Drupal\Core\Config\ConfigFactory $config_factory: The config factory service.

\Drupal\Core\Database\Connection $connection: The database connection.

\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.

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

\Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager: The menu link manager service.

\Drupal\Core\PathProcessor\InboundPathProcessorInterface $path_processor: The path processor manager service.

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

\Symfony\Component\Routing\Matcher\RequestMatcherInterface $router: The dynamic router service.

\Drupal\Core\Path\PathValidatorInterface $path_validator: The path validator.

File

src/Tracker.php, line 139

Class

Tracker
Tracks menu links and their referenced entities.

Namespace

Drupal\menu_entity_index

Code

public function __construct(ConfigFactory $config_factory, Connection $connection, EntityRepositoryInterface $entity_repository, EntityTypeManagerInterface $entity_type_manager, MenuLinkManagerInterface $menu_link_manager, InboundPathProcessorInterface $path_processor, RequestStack $request_stack, RequestMatcherInterface $router, PathValidatorInterface $path_validator) {
  $this->configFactory = $config_factory;

  // Load configuration.
  $config = $this->configFactory
    ->get('menu_entity_index.configuration');
  if ($config
    ->isNew()) {
    $this
      ->messenger()
      ->addError($this
      ->t('The @service service has not been <a href=":url">configured</a> yet.', [
      '@service' => $this
        ->t('Menu Entity Index Tracker'),
      ':url' => Url::fromRoute('menu_entity_index.configure')
        ->toString(),
    ]));
  }
  $this->config = $config;
  $this->database = $connection;
  $this->entityRepository = $entity_repository;
  $this->entityTypeManager = $entity_type_manager;
  $this->menuLinkManager = $menu_link_manager;
  $this->pathProcessor = $path_processor;
  $this->requestStack = $request_stack;
  $this->router = $router;
  $this->pathValidator = $path_validator;
}