Follow-up to #2403229: language.negotiation configuration can have overrides bleed in

Problem/Motivation

We should move language_negotiation_url_prefixes_update() logic to a static method in ConfigurableLanguage so it can be reused and remove language_negotiation_url_prefixes_update().

Proposed resolution

Move logic to a static method in ConfigurableLanguage.
Remove language_negotiation_url_prefixes_update()

Remaining tasks

Create a patch

User interface changes

None.

API changes

The following global function is removed:

language_negotiation_url_prefixes_update()

Use ConfigurableLanguage::updateAllUrlPrefixes() instead.

Files: 
CommentFileSizeAuthor
#2 2548079-language-negotiation-2.patch3.69 KBpenyaskito
PASSED: [[SimpleTest]]: [PHP 5.5 MySQL] 101,470 pass(es). View

Comments

penyaskito created an issue. See original summary.

penyaskito’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
3.69 KB
PASSED: [[SimpleTest]]: [PHP 5.5 MySQL] 101,470 pass(es). View
andypost’s picture

Status: Needs review » Needs work
+++ b/core/modules/language/src/Entity/ConfigurableLanguage.php
@@ -133,7 +133,7 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
+    self::updateAllUrlPrefixes();

@@ -266,4 +266,23 @@ public static function createFromLangcode($langcode) {
+  static function updateAllUrlPrefixes() {

visibility is not set, if this static then public and makes sense to pass config factory as argument
otoh maybe language negotiation system should add a method

penyaskito’s picture

@andypost Thanks for reviewing! I forgot visibility, must be public.
When you say adding a method to language negotiation, do you mean LanguageManagerInterface?

andypost’s picture

no, \Drupal\language\LanguageNegotiator otoh \Drupal\language\LanguageNegotiationMethodManager - not sure

penyaskito’s picture

I don't think it makes sense in \Drupal\language\LanguageNegotiator.
\Drupal\language\LanguageNegotiationMethodManager looks a better idea, but not ideal neither :-/
I think the best fit is still the ConfigurableLanguage class.

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

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.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.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.