Loading src/Plugin/EntityReferenceSelection/SiteTermSelection.php +3 −3 Original line number Diff line number Diff line Loading @@ -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'); Loading @@ -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()); } } } Loading Loading
src/Plugin/EntityReferenceSelection/SiteTermSelection.php +3 −3 Original line number Diff line number Diff line Loading @@ -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'); Loading @@ -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()); } } } Loading