Problem/Motivation

If a multilingual site is configured to use a content language negotiation through a query parameter then autocomplete post requests will not contain the query parameters from the current url and the returned entity labels will not be in the current content language in the case it doesn't matches the default language.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Maouna created an issue. See original summary.

Maouna’s picture

Status: Needs work » Needs review
FileSize
4.4 KB

Status: Needs review » Needs work

The last submitted patch, 2: 2863308-autocomplete_content_language-2.patch, failed testing.

Maouna’s picture

No interdiff because of different approach.

Maouna’s picture

Status: Needs work » Needs review
Maouna’s picture

Status: Needs review » Needs work
Maouna’s picture

Issue tags: +DevDaysSeville
hchonov’s picture

Issue summary: View changes

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.

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.

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.

andypost’s picture

Version: 8.6.x-dev » 8.7.x-dev
Assigned: Maouna » Unassigned

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’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.

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.

Tess Bakker’s picture

Status: Needs work » Needs review
FileSize
4.44 KB
1.51 KB

Used patch of comment #2, worked best for my case and changed the first part, so the patch will work with exposed filters that have autocomplete.

Status: Needs review » Needs work

The last submitted patch, 18: 2863308-autocomplete_content_language-18.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

anmolgoyal74’s picture

Status: Needs work » Needs review
FileSize
4.41 KB
1.8 KB

Tried to handle the failed test case.

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.

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.

SpadXIII’s picture

joachim’s picture

Status: Needs review » Needs work

NW for test failure.

Also:

+++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
@@ -188,6 +188,12 @@ public static function processEntityAutocomplete(array &$element, FormStateInter
+    if (method_exists($form_state->getFormObject(), 'getEntity')) {

I'm not keen on the method check. What are we actually trying to determine here?

Suresh Prabhu Parkala’s picture

Tried to fix the errors in #23 patch.

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.

Nikhil_110’s picture

Attached patch against Drupal 10.1.x

Tanuj.’s picture

patch #25 doesn't apply on drupal 10.1.x and throws this error

Checking patch core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php...
error: while searching for:
    // url.

    // First, check if processing conditions are met.
    if (!($request && !empty($options['route']) && $this->hasLowerLanguageNegotiationWeight() && $this->meetsContentEntityRoutesCondition($options['route'], $request))) {
      return $path;
    }


error: patch failed: core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php:105
error: core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php: patch does not apply

adding a new patch to fix CCF on #28, adding interdiff and reroll diff. please review

joachim’s picture

Status: Needs review » Needs work

NW for the test failure and also #24.

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.

Watergate’s picture

FileSize
3.69 KB

The patch of #29 didn't apply to Drupal 10.2. So, I've updated the patch.

I've removed the proposed changes in the FormElement class, as they have already been added to Drupal (10.2).

The points made by #2863308-24: Content language negotiation not working for entity autocomplete must still be addressed.