Commit 7e17ad6f authored by Fabrice Scoyer's avatar Fabrice Scoyer Committed by fabrice.scoyer
Browse files

Issue #3254730 by flocondetoile: D9 - remaining service entity.manager to removed

parent f29c2c73
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ class SiteTermSelection extends DefaultSelection {

    $options = [];

    $bundles = $this->entityManager->getBundleInfo('taxonomy_term');
    $bundles = $this->entityTypeBundleInfo->getBundleInfo('taxonomy_term');
    $bundle_names = $this->getConfiguration()['target_bundles'] ?: array_keys($bundles);

    $has_admin_access = $this->currentUser->hasPermission('administer taxonomy');
@@ -73,14 +73,14 @@ class SiteTermSelection extends DefaultSelection {
    foreach ($bundle_names as $bundle) {
      if ($vocabulary = Vocabulary::load($bundle)) {
        /** @var \Drupal\taxonomy\TermInterface[] $terms */
        if ($terms = $this->entityManager->getStorage('taxonomy_term')->loadTree($vocabulary->id(), 0, NULL, TRUE)) {
        if ($terms = $this->entityTypeManager->getStorage('taxonomy_term')->loadTree($vocabulary->id(), 0, NULL, TRUE)) {
          foreach ($terms as $term) {
            if (!$has_admin_access && (!$term->isPublished() || in_array($term->parent->target_id, $unpublished_terms))) {
              $unpublished_terms[] = $term->id();
              continue;
            }
            if ($term->access('view')) {
              $options[$vocabulary->id()][$term->id()] = str_repeat('-', $term->depth) . Html::escape($this->entityManager->getTranslationFromContext($term)->label());
              $options[$vocabulary->id()][$term->id()] = str_repeat('-', $term->depth) . Html::escape($this->entityRepository->getTranslationFromContext($term)->label());
            }
          }
        }