diff --git a/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php b/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php index d33a7e3..e2bbf2a 100644 --- a/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php +++ b/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php @@ -37,9 +37,15 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen '#maxlength' => 255, '#description' => $this->t('Specify an alternative path by which this data can be accessed. For example, type "/about" when writing an about page.'), ); + $pid = $items->pid; + $content_translation = $form_state->get('content_translation'); + if (isset($content_translation['target'])) { + // If creating a new translation do not use the existing pid. + $pid = NULL; + } $element['pid'] = array( '#type' => 'value', - '#value' => $items->pid, + '#value' => $pid, ); $element['source'] = array( '#type' => 'value', @@ -47,7 +53,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen ); $element['langcode'] = array( '#type' => 'value', - '#value' => $items->langcode, + '#value' => $items->getLangcode(), ); return $element; }