You are here

public function FieldResolver::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::__construct()

Creates a FieldResolver instance.

Parameters

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

\Drupal\Core\Entity\EntityFieldManagerInterface $field_manager: The field manager.

\Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info: The bundle info service.

\Drupal\jsonapi\ResourceType\ResourceTypeRepositoryInterface $resource_type_repository: The resource type repository.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

\Drupal\Core\Session\AccountInterface|null $current_user: The current user account.

File

core/modules/jsonapi/src/Context/FieldResolver.php, line 134

Class

FieldResolver
A service that evaluates external path expressions against Drupal fields.

Namespace

Drupal\jsonapi\Context

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $field_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, ResourceTypeRepositoryInterface $resource_type_repository, ModuleHandlerInterface $module_handler, AccountInterface $current_user = NULL) {
  if (is_null($current_user)) {
    @trigger_error('Calling ' . __METHOD__ . '() without the $current_user argument is deprecated in drupal:9.3.0 and will be required in drupal:10.0.0.', E_USER_DEPRECATED);
    $current_user = \Drupal::currentUser();
  }
  $this->currentUser = $current_user;
  $this->entityTypeManager = $entity_type_manager;
  $this->fieldManager = $field_manager;
  $this->entityTypeBundleInfo = $entity_type_bundle_info;
  $this->resourceTypeRepository = $resource_type_repository;
  $this->moduleHandler = $module_handler;
}