Loading modal_page.services.yml +1 −1 Original line number Diff line number Diff line services: modal_page.modals: class: Drupal\modal_page\Service\ModalPageService arguments: ['@language_manager', '@entity_type.manager', '@config.factory', '@database', '@request_stack', '@path.matcher', '@uuid', '@current_user', '@path_alias.manager', '@module_handler', '@path.current', '@entity.repository'] arguments: ['@language_manager', '@entity_type.manager', '@config.factory', '@database', '@request_stack', '@path.matcher', '@uuid', '@current_user', '@path_alias.manager', '@module_handler', '@path.current'] modal_page.helper: class: Drupal\modal_page\Service\ModalPageHelperService arguments: ['@language_manager', '@current_user', '@entity_type.manager'] src/Service/ModalPageService.php +3 −11 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ use Drupal\Component\Utility\Html; use Drupal\path_alias\AliasManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityStorageException; /** Loading Loading @@ -103,17 +102,10 @@ class ModalPageService { */ protected $projectHandler; /** * Drupal\Core\Entity\EntityRepositoryInterface service. * * @var \Drupal\Core\Entity\EntityRepositoryInterface */ protected $entityRepository; /** * Construct of Modal Page service. */ public function __construct(LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_manager, ConfigFactoryInterface $config_factory, Connection $database, RequestStack $request_stack, PathMatcherInterface $path_matcher, UuidInterface $uuid_service, AccountProxyInterface $current_user, AliasManagerInterface $alias_manager, ModuleHandlerInterface $project_handler, CurrentPathStack $current_path, EntityRepositoryInterface $entityRepository) { public function __construct(LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_manager, ConfigFactoryInterface $config_factory, Connection $database, RequestStack $request_stack, PathMatcherInterface $path_matcher, UuidInterface $uuid_service, AccountProxyInterface $current_user, AliasManagerInterface $alias_manager, ModuleHandlerInterface $project_handler, CurrentPathStack $current_path) { $this->languageManager = $language_manager; $this->entityTypeManager = $entity_manager; $this->pathMatcher = $path_matcher; Loading @@ -125,7 +117,6 @@ class ModalPageService { $this->aliasManager = $alias_manager; $this->projectHandler = $project_handler; $this->currentPath = $current_path; $this->entityRepository = $entityRepository; } /** Loading Loading @@ -642,7 +633,8 @@ class ModalPageService { public function recordFileUsage(array $uuids) { try { foreach ($uuids as $uuid) { if ($file = $this->entityRepository->loadEntityByUuid('file', $uuid)) { // We're not using DI to avoid issues on construct. if ($file = \Drupal::service('entity.repository')->loadEntityByUuid('file', $uuid)) { if ($file->status !== FILE_STATUS_PERMANENT) { $file->status = FILE_STATUS_PERMANENT; $file->save(); Loading Loading
modal_page.services.yml +1 −1 Original line number Diff line number Diff line services: modal_page.modals: class: Drupal\modal_page\Service\ModalPageService arguments: ['@language_manager', '@entity_type.manager', '@config.factory', '@database', '@request_stack', '@path.matcher', '@uuid', '@current_user', '@path_alias.manager', '@module_handler', '@path.current', '@entity.repository'] arguments: ['@language_manager', '@entity_type.manager', '@config.factory', '@database', '@request_stack', '@path.matcher', '@uuid', '@current_user', '@path_alias.manager', '@module_handler', '@path.current'] modal_page.helper: class: Drupal\modal_page\Service\ModalPageHelperService arguments: ['@language_manager', '@current_user', '@entity_type.manager']
src/Service/ModalPageService.php +3 −11 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ use Drupal\Component\Utility\Html; use Drupal\path_alias\AliasManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityStorageException; /** Loading Loading @@ -103,17 +102,10 @@ class ModalPageService { */ protected $projectHandler; /** * Drupal\Core\Entity\EntityRepositoryInterface service. * * @var \Drupal\Core\Entity\EntityRepositoryInterface */ protected $entityRepository; /** * Construct of Modal Page service. */ public function __construct(LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_manager, ConfigFactoryInterface $config_factory, Connection $database, RequestStack $request_stack, PathMatcherInterface $path_matcher, UuidInterface $uuid_service, AccountProxyInterface $current_user, AliasManagerInterface $alias_manager, ModuleHandlerInterface $project_handler, CurrentPathStack $current_path, EntityRepositoryInterface $entityRepository) { public function __construct(LanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_manager, ConfigFactoryInterface $config_factory, Connection $database, RequestStack $request_stack, PathMatcherInterface $path_matcher, UuidInterface $uuid_service, AccountProxyInterface $current_user, AliasManagerInterface $alias_manager, ModuleHandlerInterface $project_handler, CurrentPathStack $current_path) { $this->languageManager = $language_manager; $this->entityTypeManager = $entity_manager; $this->pathMatcher = $path_matcher; Loading @@ -125,7 +117,6 @@ class ModalPageService { $this->aliasManager = $alias_manager; $this->projectHandler = $project_handler; $this->currentPath = $current_path; $this->entityRepository = $entityRepository; } /** Loading Loading @@ -642,7 +633,8 @@ class ModalPageService { public function recordFileUsage(array $uuids) { try { foreach ($uuids as $uuid) { if ($file = $this->entityRepository->loadEntityByUuid('file', $uuid)) { // We're not using DI to avoid issues on construct. if ($file = \Drupal::service('entity.repository')->loadEntityByUuid('file', $uuid)) { if ($file->status !== FILE_STATUS_PERMANENT) { $file->status = FILE_STATUS_PERMANENT; $file->save(); Loading