Problem/Motivation

From the original bug report:
I have a view that lists nodes, filtered by contextual filter "Content: Has taxonomy term ID (with depth)".
In the view I override the view title in the contextual filter setting with "{{ arguments.term_node_tid_depth }}" token.

All the terms have translation, but I noticed that the title is always displayed in the default language.

Title should be displayed in current active translation.

Steps to reproduce

  • Enable content_translation module
  • add Spanish language
  • Enable content translation to Spanish for taxonomy terms
  • Create a taxonomy term (e.g. Butterfly) and translate it into Spanish (Mariposa)
  • Change the taxonomy_term view to use the "Has taxonomy term ID (with depth)" argument, as well as the depth
  • Ensure that "Replace title" is checked, and {{ arguments.term_node_tid_depth }} is used as the title replacement
  • Go to the taxonomy term page in Spanish
  • The English title will be shown instead of Spanish - this is the bug.

 The term name is not translated correctly.
 The term name is correctly translated.

Proposed resolution

- In the views argument plugins, fetch the translation from context and try to get the label from translation.

Remaining tasks

Needs review

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

CommentFileSizeAuthor
#100 2765297-nr-bot.txt90 bytesneeds-review-queue-bot
#92 2765297-nr-bot.txt3.54 KBneeds-review-queue-bot
#86 2765297-nr-bot.txt2.73 KBneeds-review-queue-bot
#73 2765297-73.patch16.11 KByogeshmpawar
#73 reroll_diff_taxonomy_translation_2765297_63_2765297-73.txt2.16 KByogeshmpawar
#63 interdiff-2765297_60_to_63.txt740 bytesjoseph.olstad
#63 taxonomy_translation_2765297_63.patch16.11 KBjoseph.olstad
#62 D8x-taxonomy_translation_2765297_62.patch16.15 KBjoseph.olstad
#60 interdiff_59_60.txt657 bytesanmolgoyal74
#60 taxonomy_translation_2765297_60.patch16.1 KBanmolgoyal74
#60 taxonomy_translation_2765297_60-test-only.patch3.28 KBanmolgoyal74
#59 test-only-taxonomy-translation-2765297-59.patch11.14 KBmohit_aghera
#59 interdiff-2765297-54-59.txt11.14 KBmohit_aghera
#59 taxonomy_translation_2765297_59.patch16.16 KBmohit_aghera
#54 taxonomy_translation_2765297_54.patch5.08 KBkishor_kolekar
#46 taxonomy_translation_2765297.patch5.03 KBducktape
#45 taxonomy_translation_2765297.patch4.99 KBducktape
#36 taxonomy_translation_2765297.patch5.29 KBducktape
#32 taxonomy_translation_2765297.patch5.66 KBducktape
#23 taxonomy-translation-2765297-23.patch6.13 KBkriboogh
#16 taxonomy-translation-2765297-16.patch6.07 KBsylus
#15 taxonomy-translation-2765297-15.patch3.52 KBsylus
#14 taxonomy-translation-2765297-14.patch3.47 KBsylus
#13 taxonomy-translation-2765297-13.patch1.29 KBsylus
#12 taxonomy-translation-2765297-12.patch3.88 KBsylus
#11 Screen Shot 2017-10-14 at 10.27.59 PM.png58.7 KBdnotes
#11 Screen Shot 2017-10-14 at 10.18.31 PM.png56.34 KBdnotes
#11 Screen Shot 2017-10-14 at 10.16.41 PM.png69.83 KBdnotes
#11 Screen Shot 2017-10-14 at 10.14.35 PM.png70.69 KBdnotes
#10 2765297-10.patch2.45 KBgoogletorp
#8 views.view_.taxonomy_term.yml8.61 KBdnotes
#6 tid_depth_translation-2765297-6.patch675 bytesMunavijayalakshmi
#2 tid_depth_translation-2765297-2.patch668 bytesheikki

Issue fork drupal-2765297

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

heikki created an issue. See original summary.

heikki’s picture

markdorison’s picture

@heikki Can you provide more detail on the view you are describing or even provide an export of an example view so we might reproduce the issue you are describing?

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Munavijayalakshmi’s picture

Rerolled the patch.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dnotes’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
8.61 KB

This works, and it looks like the proper solution (though check with views maintainers). Steps to reproduce, tested on Simplytest.me:

  • Enable content_translation module
  • add Spanish language
  • Enable content translation to Spanish for taxonomy terms
  • Create a taxonomy term (e.g. Butterfly) and translate it into Spanish (Mariposa)
  • Change the taxonomy_term view to use the "Has taxonomy term ID (with depth)" argument, as well as the depth
  • Ensure that "Replace title" is checked, and {{ arguments.term_node_tid_depth }} is used as the title replacement
  • Go to the taxonomy term page in Spanish
  • The English title will be shown instead of Spanish - this is the bug.

I'll attach the exported view config.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update, +Needs screenshots, +Needs tests

Thanks @dnotes, those steps to reproduce help. Adding them to the issue summary with screenshots of the before-and-after would be helpful.

Removing credit for @Munavijayalakshmi as the reroll was not needed there.

+++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
@@ -133,7 +133,7 @@ public function query($group_by = FALSE) {
-      return $term->getName();
+      return \Drupal::entityManager()->getTranslationFromContext($term)->label();

If this Views plugin needs the entity manager, it should have it inject. It might even already have it.

Finally, since this issue describes a bug, we need an automated regression test for the bug, that can be attached with by itself and show a fail on testing, followed by the whole patch which should pass.

Thanks everyone!

googletorp’s picture

I rewrote the patch using dependency injection as requested in #9.

Also I used entity.reposity instead of entity.manager since the entity.manager has been deprecated.

We still need to do tests etc for this.

dnotes’s picture

Added steps to reproduce and screenshots to the description. This is with the patches from 2 and 6.

I'm a little confused that in order to fix this one-line bug, we are also updating the entire argument to use dependency injection and newer services. Shouldn't that be a separate issue applied to all the taxonomy term arguments at the same time? After all, those same changes are needed for all of the taxonomy term arguments, not just this one. If we update this because of a separate bug, then the code for the arguments get out of sync with each other and it just becomes a bigger mess than it is now.

Writing tests that incorporate changes to a view is beyond my capability.

sylus’s picture

I have also updated the taxonomy.tokens.inc with roughly the same fix as the following also wasn't working with Taxonomy:

use \Drupal\taxonomy\Entity\Term;
$token_service = \Drupal::service('token');
$term1 = Term::load(1236);
$output = $token_service->replace('[term:name]', array('term' => $term1), array('langcode' => 'fr'));
dpm($output);
sylus’s picture

Here is a patch just with my tokens fixes.

sylus’s picture

Another patch with some other corrections I needed to apply to Core 8.4.3. Will post an updated patch against dev soon.

sylus’s picture

FileSize
3.52 KB
sylus’s picture

Status: Needs work » Needs review
FileSize
6.07 KB

Okay this is incorporates the fixes from #2765297-10: Return translated term name on views "Content: Has taxonomy term ID (with depth)" as well as fixes for tokens + regular Taxonomy using {{ arguments.tid }}

Status: Needs review » Needs work

The last submitted patch, 16: taxonomy-translation-2765297-16.patch, failed testing. View results

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

alduya’s picture

The same problem exists for the Nid / Content: ID filter.
I created a different issue for that: https://www.drupal.org/project/drupal/issues/2952252

Anybody’s picture

Did you check special character behaviour for term names? We should ensure to be not double-escaped. For example & => not becoming => & in view title.

robertom’s picture

Hi, sorry for my bad english.

With this patch applied, I have a side effect on term alias.

I have a pathauto pattern set as "[term:parents]/[term:name]" for a vocabulary, when I save a term of this vocabulary, the alias generated for all languages of the term substitute the [term:name] token with the last translation saved instead of use the translated name.

kriboogh’s picture

The problem is the patch in taxonomy.tokens.inc

if ($type == 'term' && !empty($data['term'])) {
     $term = $data['term'];
+    $term = \Drupal::entityManager()->getTranslationFromContext($term);

This causes the term to be returned to be in the current active language if none was given to getTranslationFromContext.

Pathauto hands over the language as an option, so to fix it, it should be:

if ($type == 'term' && !empty($data['term'])) {
     $term = $data['term'];
+    $term = \Drupal::entityManager()->getTranslationFromContext($term, isset($options['langcode']) ? $options['langcode'] : NULL);

BTW, this also causes problems in bulk pathauto generation with patterns having term:name tokens. These are all generated in the current active language. If for example you run pathauto bulk while using the admin pages in french, all aliases will have the french translation, even if your pattern is set for entities in an other language.

kriboogh’s picture

Anybody’s picture

Status: Needs work » Needs review

Manual code review looks good so far from a logical perspective. Now we need some people to test and confirm.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

willeaton’s picture

I confirm that the patch in #23 works in D8.6.1

googletorp’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the test, per #24 and #26 I think we are good to go unless some one can spot any issues here.

catch’s picture

Status: Reviewed & tested by the community » Needs work

This could use some automated test coverage.

Viktor999’s picture

I tried the patch in #23 in D8.6.4 and 8.6.5, but it does not work for me.

Berdir’s picture

  1. +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
    @@ -39,7 +46,13 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
    +      $configuration,
    +      $plugin_id,
    +      $plugin_definition,
    +      $container->get('entity.manager')->getStorage('taxonomy_term'),
    +      $container->get('entity.repository')
    +    );
    

    lets update this and others to use entity_type.manager instead when we touch the line anyway.

  2. +++ b/core/modules/taxonomy/taxonomy.tokens.inc
    @@ -98,6 +98,7 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable
       if ($type == 'term' && !empty($data['term'])) {
         $term = $data['term'];
    +    $term = \Drupal::entityManager()->getTranslationFromContext($term, isset($options['langcode']) ? $options['langcode'] : NULL);
    

    this should also use the entity repository service

daxgrapol’s picture

I have tested patch #23 on Drupal 8.6.5 and it works only if using "Content: Has taxonomy term ID (with depth)" as contextual filter.

In my case I have to use a Relationship with Term and then use it in the contextual filter "Taxonomy term: name" (I take the Term name in the URL and I override the title with {{ arguments.name }}, no other method works for me). In this case, patch dosn't work.

ducktape’s picture

Works for me, tested on 8.7.2. Updated patch with remarks from @Berdir.

@daxgrapol I haven't tried reconstructing your case, but it looks to me you get your title straight from the path, so I think the translated name should be in there already.

ducktape’s picture

Status: Needs work » Needs review
mpp’s picture

  1. +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
    @@ -22,6 +23,11 @@
    +   protected $entityRepository;
    

    Nitpick: we should always keep the same order between "EntityRepositoryInterface" & "EntityStorageInterface".
    Since we added the EntityStorageInterface last we can put $entityRepository after $termStorage.

  2. +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
    @@ -30,9 +36,10 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin
    +    $this->entityRepository = $entityRepository;
         $this->termStorage = $termStorage;
    

    Same remark.

  3. +++ b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php
    @@ -16,6 +17,11 @@
    +   protected $entityRepository;
    

    Same remark.

  4. +++ b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php
    @@ -24,9 +30,10 @@ class Taxonomy extends NumericArgument implements ContainerFactoryPluginInterfac
    +    $this->entityRepository = $entityRepository;
    

    Same remark.

@berdir, should we test this against 8.8 or 8.7?

ducktape’s picture

Version: 8.6.x-dev » 8.7.x-dev
ducktape’s picture

Updated patch with remarks from @mpp

mpp’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed and tested.

Anybody’s picture

Re-Confirming RTBC by manual code review and additional manual testing. Happy to see this committed soon :)
Thank you all!

Lendude’s picture

Status: Reviewed & tested by the community » Needs work

As @xjm pointed out in #9, this still needs automated test coverage.

borisson_’s picture

  1. +++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
    @@ -27,20 +28,32 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin
    +   * @var EntityRepositoryInterface
    

    Should be FQN.

  2. +++ b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php
    @@ -21,13 +22,19 @@ class Taxonomy extends NumericArgument implements ContainerFactoryPluginInterfac
    +   * @var EntityRepositoryInterface
    

    ^

  3. +++ b/core/modules/taxonomy/taxonomy.tokens.inc
    @@ -95,9 +95,10 @@ function taxonomy_tokens($type, $tokens, array $data, array $options, Bubbleable
    -  $taxonomy_storage = \Drupal::entityManager()->getStorage('taxonomy_term');
    +  $taxonomy_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
    

    This change is unrelated.

mpp’s picture

This change is unrelated.

@borisson_, see #30 by @berdir.

Berdir’s picture

Version: 8.7.x-dev » 8.8.x-dev

This needs to go into 8.8 first, where it won't apply because these entity manager related changes already happened there.

borisson_’s picture

@mpp, this should only happen when we update the line anyway, there is no other change in that line so I don't think that makes it allowed.

mpp’s picture

Thanks for the feedback @berdir, @borisson_.

off-topic: The same problem seems to occur for search_api view arguments (in Drupal\search_api\Plugin\views\argument\SearchApiTerm), see https://www.drupal.org/project/search_api/issues/3064479

ducktape’s picture

Rerolled against 8.8.

ducktape’s picture

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

mdupont’s picture

EDIT: commented on the wrong issue

Anybody’s picture

Priority: Normal » Major

I just ran into the problem and can confirm this problem still exists. Replacement patterns from contextual filters are not usable on multilang sites and return unexpected results. Due to this I'll set the priority to Major. There is no workaround available.

Anybody’s picture

I can confirm patch #46 fixes the problems for us in a Drupal 8.9.2 installation without any side-effects experienced.

What's still missing since #9 & #39 is automated test coverage and there's still a TODO in the patch!

joseph.olstad’s picture

patch 46 needs a reroll for 9.1.x
patch 46 applies cleanly to 9.0.x
patch 46 applies cleanly to 8.9.x

kishor_kolekar’s picture

Assigned: Unassigned » kishor_kolekar
kishor_kolekar’s picture

I have re-roll the patch for 9.1.x

Status: Needs review » Needs work

The last submitted patch, 54: taxonomy_translation_2765297_54.patch, failed testing. View results

kishor_kolekar’s picture

Assigned: kishor_kolekar » Unassigned

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

sir_squall’s picture

I tried the patch #46 taxonomy_translation_2765297_0.patch in D9.0.7 and everything is working well

mohit_aghera’s picture

Adding a few test cases to validate the scenarios.
Approach:
Pretty much same as mentioned in steps to reproduce section.
Except I've created view with different URL, so it doesn't have issues with default taxonomy terms path.

anmolgoyal74’s picture

The last submitted patch, 60: taxonomy_translation_2765297_60-test-only.patch, failed testing. View results

joseph.olstad’s picture

oh wow thanks @anmolgoyal74, I need this patch ! :)

Rerolled for D8.9.x
(I have a project that needs this)

The last submitted patch, 62: D8x-taxonomy_translation_2765297_62.patch, failed testing. View results

joseph.olstad’s picture

Contrary to what the testbot says, patch 63 applies cleanly to D8.9.x, D9.0.x, D9.1.x, D9.2.x

Fernly’s picture

#63 works fine in 9.1.x. Thank you.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

robertoperuzzo’s picture

Thank you joseph.olstad your patch #63 works on D9.1.9.

Anybody’s picture

Finally, confirming RTBC for #63, thank you very, very much @joseph.olstad and the others. Works on Drupal 9.2 and 9.3!

#63 contains tests, is that enough or are there any concerns to add further tests? Otherwise I'd suggest to remove that tag and set this RTBC?

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

alexverb’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Patch works properly. Removing testing tag and setting RTBC.

Lendude’s picture

Status: Reviewed & tested by the community » Needs work

Looks great and it's fantastic to see the test coverage, but still needs a little work I'm afraid.

+++ b/core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
@@ -26,13 +27,21 @@ class IndexTidDepth extends ArgumentPluginBase implements ContainerFactoryPlugin
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $termStorage, EntityRepositoryInterface $entityRepository) {

+++ b/core/modules/taxonomy/src/Plugin/views/argument/Taxonomy.php
@@ -21,13 +22,19 @@ class Taxonomy extends NumericArgument implements ContainerFactoryPluginInterfac
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $term_storage, EntityRepositoryInterface $entityRepository) {

Unfortunately we can't change these constructors without some BC layer (default it to NULL and inject from \Drupal and add a deprecation message that you now need to inject this, should be some examples in core). Anything extending these classes could break otherwise.
Edit: Or don't we do this dance for plugins?

Also, it seems we are changing 2 plugins, but only have test coverage for 1, so we need to extend the coverage to both plugins that get changed.

yogeshmpawar’s picture

Reroll against 9.4.x latest branch & added reroll diff for reviewers.

yogeshmpawar’s picture

Status: Needs review » Needs work

Keeping it in NW for #72

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

joseph.olstad’s picture

Issue tags: +Needs tests

While we do have test coverage, Lendude mentioned that one additional test is required.

joseph.olstad’s picture

joseph.olstad’s picture

Pretty sure to fix the tests this yml file needs to be corrected/updated in a vanilla install of D11 or D10.2 . (With the patch applied of course)

core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.taxonomy_translated_term_name_test.yml

I'm hoping someone can carry the baton from here.

mohit_aghera’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs tests

- Tests are green now.
There was one deprecated config change in view. Sorted that out.

- Updated issue summary and moving it to Needs Review
- Removed Needs test tag since it is not required anymore.

mohit_aghera’s picture

Issue summary: View changes
mohit_aghera’s picture

Status: Needs review » Needs work

Working on the test coverage for the second plugin.

mohit_aghera’s picture

Status: Needs work » Needs review

- Added the test case for the another ViewsArgument plugin.
- Tests are passing on local as well as CI
- Unusual failure form nightwatch tests, triggered the job again.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
2.73 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

joseph.olstad’s picture

Status: Needs work » Needs review
joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community

@mohit_rocks , thanks for the excellent work on the tests! Marking this as ready.

alexpott’s picture

Hiding all the patch files since this issue is using an MR.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Added some review comments to the MR. This is a nice - we need to take care of classes that extend the core classes and I think there is a slightly better way of doing things.

mohit_aghera’s picture

Status: Needs work » Needs review

Addressed the PR feedback.
I think https://git.drupalcode.org/project/drupal/-/merge_requests/6625#note_276326 would need some verification while doing review.
I'm somewhat confused about that.

Other point seems clear.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
3.54 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

joseph.olstad’s picture

Status: Needs work » Needs review
joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community

ok, it's clean now.
RTBC

alexpott’s picture

I've made a mistake here. DeprecatedServicePropertyTrait doesn't support entity storages. I'll fix the MR.

mohit_aghera’s picture

@alexpott do we need a change record for this one?

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

@mohit_aghera - yes we should have something small and simple... and the @see should point to it and not this issue. Great catch.

Can you add one, fix the MR and then set this back to RTBC?

alexpott’s picture

Here's an example MR doing the same thing... https://www.drupal.org/node/3397213

mohit_aghera’s picture

Status: Needs work » Reviewed & tested by the community

Change record created. Back to RTBC

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
90 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

adwivedi008 made their first commit to this issue’s fork.

adwivedi008’s picture

Status: Needs work » Reviewed & tested by the community

Resolved the coding standard issue at last MR due to which the pipeline was failing and setting back the status to RTBC from Needs works

Please review and suggest if any other changes are required.

mohit_aghera’s picture

@adwivedi008, can you please be sure that we need to fix the issues?

Reason is comment in #100is saying that patch is no longer applied to the core.
In this case, you need to merge latest 11.x to the branch.
I tried that and it seemed to be working fine.

alexpott’s picture

@adwivedi008 your fixes are not fixes - core's coding standards are checked on every commit to an MR - the pipeline was green after #99 but your changes broke the pipeline. The "drupal" coding standard as detailed by coder is not the the core coding standard. Core is working towards it but we should never make out of scope changes to satisfy it and we should adhere to the coding standard set in core/phpcs.xml.dist as the "drupal" coding standard from coder actually needs fixing. I have reverted your changes.

mohit_aghera’s picture

Updated branch with latest 11.x head since test case failures were related to 11.x HEAD only.
Keeping it to RTBC, will check if there are any failures.

alexpott’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 18c45f5f23 to 11.x and 462d3ac638 to 10.3.x. Thanks!

It'd be good to finish up #2640994: Label token replacement for views entity reference arguments not working and put a more generic fix in place.

  • alexpott committed 462d3ac6 on 10.3.x
    Issue #2765297 by mohit_aghera, joseph.olstad, sylus, ducktape, alexpott...

  • alexpott committed 18c45f5f on 11.x
    Issue #2765297 by mohit_aghera, joseph.olstad, sylus, ducktape, alexpott...

  • catch committed 8ac67595 on 10.3.x
    Revert "Issue #2765297 by mohit_aghera, joseph.olstad, sylus, ducktape,...

  • catch committed 1600f99d on 11.x
    Revert "Issue #2765297 by mohit_aghera, joseph.olstad, sylus, ducktape,...
catch’s picture

Version: 10.3.x-dev » 11.x-dev
Status: Fixed » Needs work

This caused the gitlab performance test jobs to fail over the weekend, with:

Remaining self deprecation notices (2)
  1x: The "Drupal\KernelTests\KernelTestBase::expectDeprecationMessage()" method is considered internal use expectDeprecation() instead. It may change without further notice. You should not extend it from "Drupal\Tests\taxonomy\Kernel\Views\ViewsArgumentDeprecationTest".
    1x in DrupalListener::endTest from Drupal\Tests\Listeners
  1x: The "Drupal\KernelTests\KernelTestBase::expectDeprecationMessageMatches()" method is considered internal use expectDeprecation() instead. It may change without further notice. You should not extend it from "Drupal\Tests\taxonomy\Kernel\Views\ViewsArgumentDeprecationTest".
    1x in DrupalListener::endTest from Drupal\Tests\Listeners

Since ViewsArgumentDeprecationTest appears to be mainly (only?) testing the constructor deprecation, I don't think that was necessary to add in the first place and we could just remove the test, but I didn't review to see if there was a better reason for adding it.

mohit_aghera’s picture

@catch
I added that initially and my intention was to validate two things.

  1. Validate the deprecation message being thrown
  2. I should be able use and invoke the older plugins with different constructor argument
    $plugin = \Drupal::service('plugin.manager.views.argument')->createInstance('taxonomy_views_argument_test', []);
        $this->assertInstanceOf(TaxonomyViewsArgumentTest::class, $plugin);

Happy to remove the test case entirely or just expect deprecation only.
Let me know your thoughts.

alexpott’s picture

Status: Needs work » Reviewed & tested by the community

@catch @mohit_aghera this test only caused that because it unnecessarily used the trait. Remove the use and this will pass fine as we literally have hundreds of other deprecation tests doing the same thing.

I think leaving a test in in this case is okay because of the slightly more complicated dance of changing a parameter instead of just adding or removing a parameter.

Given this is just removing usage of a trait setting back to rtbc.

catch’s picture

Makes sense to me - I can re-commit this a bit later but also think it'd be fine for @alexpott to commit the updated MR here since it's a tiny change.

alexpott’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 1bcc7f34e6 to 11.x and 46564ee733 to 10.3.x. Thanks!

Second time lucky.

  • alexpott committed 46564ee7 on 10.3.x
    Issue #2765297 by mohit_aghera, joseph.olstad, sylus, alexpott, ducktape...

  • alexpott committed 1bcc7f34 on 11.x
    Issue #2765297 by mohit_aghera, joseph.olstad, sylus, alexpott, ducktape...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.