Problem/Motivation

Proposed resolution

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Update the issue summary Instructions

User interface changes

API changes

Original report by @ashutoshsngh

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ashutoshsngh’s picture

Assigned: ashutoshsngh » Unassigned
Status: Needs work » Needs review
FileSize
8.96 KB
ashutoshsngh’s picture

Issue tags: -Novice. @deprecated +Novice. @deprecated #dcdelhi

Status: Needs review » Needs work

The last submitted patch, 1: drupal8-remove-taxonomy_term_load_parents-2405365-1.patch, failed testing.

ashutoshsngh’s picture

Status: Needs work » Needs review
FileSize
8.97 KB
yogen.prasad’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/forum/src/Form/ForumForm.php
    @@ -129,7 +129,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
    -    $parents = taxonomy_term_load_parents($tid);
    +    $parents = \Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($tid);
    

    Should be injected.

  2. +++ b/core/modules/taxonomy/src/Entity/Term.php
    @@ -67,7 +67,7 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti
    -          $parents = taxonomy_term_load_parents($child->id());
    +          $parents = \Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($child->id());
    

    use $this->entityManager() instead of \Drupal::entityManager()

  3. +++ b/core/modules/taxonomy/src/TermForm.php
    @@ -23,7 +23,7 @@ public function form(array $form, FormStateInterface $form_state) {
    -    $parent = array_keys(taxonomy_term_load_parents($term->id()));
    +    $parent = array_keys(\Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($term->id()));
    
    @@ -34,12 +34,12 @@ public function form(array $form, FormStateInterface $form_state) {
    -      $parent = array_keys(taxonomy_term_load_parents($term->id()));
    +      $parent = array_keys(\Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($term->id()));
    

    Should be $this->entityManger->getStorage(...

  4. +++ b/core/modules/taxonomy/src/TermForm.php
    @@ -34,12 +34,12 @@ public function form(array $form, FormStateInterface $form_state) {
    -    // taxonomy_get_tree and taxonomy_term_load_parents may contain large
    +    // taxonomy_get_tree and \Drupal::entityManager()->getStorage('taxonomy_term')->loadParents() may contain large
    

    Too long and we could change this to just say that the term's might have a large number of parents.

gaurav_varshney’s picture

Status: Needs work » Needs review
FileSize
8.96 KB

@alexpott all the changes has been done.

ashutoshsngh’s picture

Status: Needs review » Needs work

@gaurav you have missed second change in alexpott comment.

+++ b/core/modules/taxonomy/src/Entity/Term.php
@@ -67,7 +67,7 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti
-          $parents = taxonomy_term_load_parents($child->id());
+          $parents = \Drupal::entityManager()->getStorage('taxonomy_term')->loadParents($child->id());
sonu.raj.chauhan’s picture

Status: Needs work » Needs review
FileSize
8.91 KB
YesCT’s picture

Issue summary: View changes
Issue tags: -Novice. @deprecated #dcdelhi +Novice, +@deprecated, +#dcdelhi, +Needs issue summary update

Tags are separated with a comma, not a space.

LinL’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

No longer applies.

mrjmd’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
8.92 KB

Reroll attached.

Mile23’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Needs a reroll.

$ git apply remove-usage-of-taxonomy-term-load-parents-2405365-12.patch 
error: patch failed: core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyTermTest.php:99
error: core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyTermTest.php: patch does not apply
error: patch failed: core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php:56
error: core/modules/taxonomy/src/Tests/TaxonomyTermIndentationTest.php: patch does not apply

Also a minor coding standards thing:

+++ b/core/modules/taxonomy/src/TermForm.php
@@ -34,12 +34,12 @@ public function form(array $form, FormStateInterface $form_state) {
+    // the term's might have a large number of parents.
+    // so we check for taxonomy.settings:override_selector

Needs capitalization, punctuation, and wrap at 80 chars.

rpayanm’s picture

Noe_’s picture

Isn't this a duplicate of https://www.drupal.org/node/2452577 ?

Mile23’s picture

Indeed it is. Either #2452577: Remove Usage of deprecated function taxonomy_* is the duplicate, or this one is.

I'd say the other one has more stuff done and a wider scope, even though it's newer.

xjm’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2452577: Remove Usage of deprecated function taxonomy_*

Yep, let's close this as a duplicate of that one, because we need to get the taxonomy storage for all four of the deprecated functions, so it makes sens to do it in one patch. Closing this as a duplicate of that one.