diff --git a/core/modules/taxonomy/src/Entity/Term.php b/core/modules/taxonomy/src/Entity/Term.php index 1855dae..6557171 100644 --- a/core/modules/taxonomy/src/Entity/Term.php +++ b/core/modules/taxonomy/src/Entity/Term.php @@ -224,13 +224,6 @@ public function getName() { /** * {@inheritdoc} */ - public function getTranslatedName() { - return \Drupal::entityManager()->getTranslationFromContext($this)->label(); - } - - /** - * {@inheritdoc} - */ public function setName($name) { $this->set('name', $name); return $this; @@ -258,11 +251,4 @@ public function getVocabularyId() { return $this->get('vid')->target_id; } - /** - * {@inheritdoc} - */ - public function getTreeDepth() { - return $this->depth; - } - } diff --git a/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php b/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php index bccee08..3c59804 100644 --- a/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTid.php @@ -24,7 +24,7 @@ public function titleQuery() { $titles = array(); $terms = Term::loadMultiple($this->value); foreach ($terms as $term) { - $titles[] = String::checkPlain($term->getTranslatedName()); + $titles[] = String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); } return $titles; } diff --git a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php index 67fe7bf..9a9fd47 100644 --- a/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyIndexTid.php @@ -110,7 +110,7 @@ public function preRender(&$values) { foreach ($result as $node_nid => $data) { foreach ($data as $tid => $term) { - $this->items[$node_nid][$tid]['name'] = $term->getTranslatedName(); + $this->items[$node_nid][$tid]['name'] = \Drupal::entityManager()->getTranslationFromContext($term)->label(); $this->items[$node_nid][$tid]['tid'] = $tid; $this->items[$node_nid][$tid]['vocabulary_vid'] = $term->getVocabularyId(); $this->items[$node_nid][$tid]['vocabulary'] = String::checkPlain($vocabularies[$term->getVocabularyId()]->label()); diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php index 84dd855..1b2681a 100644 --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php @@ -114,7 +114,7 @@ protected function valueForm(&$form, &$form_state) { if ($default) { $default .= ', '; } - $default .= String::checkPlain($term->getTranslatedName()); + $default .= String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); } } @@ -137,7 +137,7 @@ protected function valueForm(&$form, &$form_state) { if ($tree) { foreach ($tree as $term) { $choice = new \stdClass(); - $choice->option = array($term->id() => str_repeat('-', $term->getTreeDepth()) . String::checkPlain($term->getTranslatedName())); + $choice->option = array($term->id() => str_repeat('-', $term->depth) . String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label())); $options[] = $choice; } } @@ -154,7 +154,7 @@ protected function valueForm(&$form, &$form_state) { } $terms = Term::loadMultiple($query->execute()); foreach ($terms as $term) { - $options[$term->id()] = String::checkPlain($term->getTranslatedTerm()); + $options[$term->id()] = String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); } } @@ -314,7 +314,7 @@ function validate_term_strings(&$form, $values) { ->addTag('term_access'); $terms = Term::loadMultiple($query->execute()); foreach ($terms as $term) { - unset($missing[strtolower($term->getTranslatedTerm())]); + unset($missing[strtolower(\Drupal::entityManager()->getTranslationFromContext($term)->label())]); $tids[] = $term->id(); } @@ -352,7 +352,7 @@ public function adminSummary() { $this->value = array_filter($this->value); $terms = Term::loadMultiple($this->value); foreach ($terms as $term) { - $this->value_options[$term->id()] = String::checkPlain($term->getTranslatedName()); + $this->value_options[$term->id()] = String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); } } return parent::adminSummary(); diff --git a/core/modules/taxonomy/src/TermInterface.php b/core/modules/taxonomy/src/TermInterface.php index d708d95..433f487 100644 --- a/core/modules/taxonomy/src/TermInterface.php +++ b/core/modules/taxonomy/src/TermInterface.php @@ -60,14 +60,6 @@ public function setFormat($format); public function getName(); /** - * Gets the translated name of the term. - * - * @return string - * The translated name of the term. - */ - public function getTranslatedName(); - - /** * Sets the name of the term. * * @param int $name @@ -103,12 +95,4 @@ public function setWeight($weight); */ public function getVocabularyId(); - /** - * Gets the depth of a term in a vocabulary. - * - * @return int - * The depth of the term in the hierarchy; 0 is root level. - */ - public function getTreeDepth(); - } diff --git a/core/modules/taxonomy/src/TermStorage.php b/core/modules/taxonomy/src/TermStorage.php index 63e8144..9338ab7 100644 --- a/core/modules/taxonomy/src/TermStorage.php +++ b/core/modules/taxonomy/src/TermStorage.php @@ -280,7 +280,7 @@ public function getNodeTerms($nids, $vocabs = array(), $langcode = NULL) { $all_tids[] = $term_record->tid; } - $all_terms = Term::loadMultiple($all_tids); + $all_terms = $this->loadMultiple($all_tids); $terms = array(); foreach ($results as $nid => $tids) { foreach ($tids as $tid) { diff --git a/core/modules/taxonomy/src/TermStorageInterface.php b/core/modules/taxonomy/src/TermStorageInterface.php index d3825a1..f450db0 100644 --- a/core/modules/taxonomy/src/TermStorageInterface.php +++ b/core/modules/taxonomy/src/TermStorageInterface.php @@ -91,9 +91,10 @@ public function resetWeights($vid); * @param array $nids * Node IDs to retrieve terms for. * @param array $vocabs - * (optional) A vocabularies array to restrict the term search. + * (optional) A vocabularies array to restrict the term search. Defaults to + * empty array. * @param string $langcode - * (optional) A language code to restrict the term search. + * (optional) A language code to restrict the term search. Defaults to NULL. * * @return array * An array of nids and the term entities they were tagged with.