Follow-up from #2201051: Convert path.module form alters to a field widget.

      // Entity language needs special care. Since the language of the URL alias
      // depends on the entity language, and the entity language can be switched
      // right within the same form, we need to conditionally overload the
      // originally assigned URL alias language.
      // @see \Drupal\content_translation\ContentTranslationController::entityFormAlter()
      if (isset($form_state['values']['langcode'])) {
        $form_builder->setValue($element['langcode'], $form_state['values']['langcode'], $form_state);
      }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

It should be possibile to just use $entity->language()->id, the fact we weren't able to do that in #2201051: Convert path.module form alters to a field widget means there's a bug lying somewhere...

plach’s picture

@sun is pointing out this comment tried to implement this approach:

https://drupal.org/comment/8613511#comment-8505253

It's probably a good idea to have a look to the test failures over there. @andypost was pointing out the same issue in:

https://drupal.org/comment/8518449#comment-8518449

andypost’s picture

Status: Postponed » Active
andypost’s picture

Status: Active » Needs review
FileSize
1.28 KB

Let's see how it works now

andypost’s picture

FileSize
2.23 KB

It works so finally clean-up code here

plach’s picture

Status: Needs review » Reviewed & tested by the community

Nice clean-up :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 5: 2225977-path-lang-6.patch, failed testing.

Status: Needs work » Needs review

andypost queued 5: 2225977-path-lang-6.patch for re-testing.

andypost’s picture

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

Status: Reviewed & tested by the community » Fixed

Committed 3181fdd and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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