Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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);
}
Comment | File | Size | Author |
---|---|---|---|
#5 | 2225977-path-lang-6.patch | 2.23 KB | andypost |
#4 | 2225977-path-lang-5.patch | 1.28 KB | andypost |
Comments
Comment #1
plachIt 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...Comment #2
plach@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
Comment #3
andypostComment #4
andypostLet's see how it works now
Comment #5
andypostIt works so finally clean-up code here
Comment #6
plachNice clean-up :)
Comment #9
andypostComment #10
alexpottCommitted 3181fdd and pushed to 8.x. Thanks!