diff --git a/src/Plugin/Field/FieldWidget/ParagraphsBrowserWidget.php b/src/Plugin/Field/FieldWidget/ParagraphsBrowserWidget.php index ddde73471..69c5e728c 100644 --- a/src/Plugin/Field/FieldWidget/ParagraphsBrowserWidget.php +++ b/src/Plugin/Field/FieldWidget/ParagraphsBrowserWidget.php @@ -75,4 +75,11 @@ protected function getSettingOptions($setting_name) { return $options; } + /** + * {@inheritdoc} + */ + protected function supportsAsymmetricTranslations() { + return TRUE; + } + } diff --git a/src/Plugin/Field/FieldWidget/ParagraphsBrowserWidgetTrait.php b/src/Plugin/Field/FieldWidget/ParagraphsBrowserWidgetTrait.php index 1a840fde7..82ce1be2d 100644 --- a/src/Plugin/Field/FieldWidget/ParagraphsBrowserWidgetTrait.php +++ b/src/Plugin/Field/FieldWidget/ParagraphsBrowserWidgetTrait.php @@ -97,27 +97,20 @@ public function formMultipleElements(FieldItemListInterface $items, array &$form $elements['#attached']['library'][] = 'paragraphs_browser/modal'; - $storage = $form_state->getStorage(); - - if (!$this->fieldDefinition->isTranslatable() && $storage['langcode'] !== $storage['entity_default_langcode']) { - unset($elements['add_more']); - } - else { - $elements['add_more']['browse'] = array( - '#type' => 'submit', - '#value' => $this->t('Add :title', [':title' => $this->getSetting('title')]), - '#attributes' => ['class' => ['js-show']], - '#ajax' => [ - 'url' => Url::fromRoute( - 'paragraphs_browser.paragraphs_browser_controller', [ - 'field_config' => implode('.', array($items->getEntity()->getEntityTypeId(), $items->getEntity()->bundle(), $this->fieldDefinition->getName())), - 'paragraphs_browser_type' => $this->getSetting('paragraphs_browser'), - 'uuid' => $this->uuid, - ] - ), - ], - ); - } + $elements['add_more']['browse'] = array( + '#type' => 'submit', + '#value' => $this->t('Add :title', [':title' => $this->getSetting('title')]), + '#attributes' => ['class' => ['js-show']], + '#ajax' => [ + 'url' => Url::fromRoute( + 'paragraphs_browser.paragraphs_browser_controller', [ + 'field_config' => implode('.', array($items->getEntity()->getEntityTypeId(), $items->getEntity()->bundle(), $this->fieldDefinition->getName())), + 'paragraphs_browser_type' => $this->getSetting('paragraphs_browser'), + 'uuid' => $this->uuid, + ] + ), + ], + ); if (isset($elements['#cardinality']) && $elements['#cardinality'] != -1) { $keyCount = count(