Loading src/Plugin/Field/FieldWidget/EntityReferenceLayoutWidget.php +9 −1 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Render\Renderer; use Drupal\paragraphs\ParagraphInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Plugin\PluginFormInterface; use Drupal\Core\Plugin\PluginWithFormsInterface; Loading Loading @@ -979,8 +980,15 @@ class EntityReferenceLayoutWidget extends WidgetBase implements ContainerFactory * {@inheritdoc} */ public function massageFormValues(array $values, array $form, FormStateInterface $form_state) { foreach ($values as $delta => $value) { foreach ($values as $delta => &$item) { unset($values[$delta]['actions']); if ($item['entity'] instanceof ParagraphInterface) { /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph_entity */ $paragraph_entity = $item['entity']; $paragraph_entity->setNeedsSave(TRUE); $item['target_id'] = $paragraph_entity->id(); $item['target_revision_id'] = $paragraph_entity->getRevisionId(); } } return $values; } Loading Loading
src/Plugin/Field/FieldWidget/EntityReferenceLayoutWidget.php +9 −1 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Render\Renderer; use Drupal\paragraphs\ParagraphInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Plugin\PluginFormInterface; use Drupal\Core\Plugin\PluginWithFormsInterface; Loading Loading @@ -979,8 +980,15 @@ class EntityReferenceLayoutWidget extends WidgetBase implements ContainerFactory * {@inheritdoc} */ public function massageFormValues(array $values, array $form, FormStateInterface $form_state) { foreach ($values as $delta => $value) { foreach ($values as $delta => &$item) { unset($values[$delta]['actions']); if ($item['entity'] instanceof ParagraphInterface) { /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph_entity */ $paragraph_entity = $item['entity']; $paragraph_entity->setNeedsSave(TRUE); $item['target_id'] = $paragraph_entity->id(); $item['target_revision_id'] = $paragraph_entity->getRevisionId(); } } return $values; } Loading