Save paragraph widget data in custom form I am adding a node field widget in a custom form as described here and my code is:

$site_settings_node = Node::load($node_id);
$entity_form_display = \Drupal::service('entity_type.manager')-&gt;getStorage('entity_form_display')
  -&gt;load('node.node_type.default');
if ($widget = $entity_form_display-&gt;getRenderer('field_my_field')) {
  $items = $site_settings_node-&gt;get('field_my_field');
  $items-&gt;filterEmptyItems();
  $form['#parents'] = array();
  $form['custom_form_field'] = $widget-&gt;form($items, $form, $form_state);
}


How do I update the paragraph field values in my submit handler? Is there something like the below that I can do?

$widget = $entity_form_display-&gt;getRenderer('field_my_field')
$widget-&gt;submit($items, $form, $form_state);
I found the solution via this article. Though for the solution to work specifically for the paragraph field, I had to add a patch for an issue discussed here.

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['#parents'] = array();

  $node_id = 1; // Some node
  $entity = Node::load($node_id);
  $form_state-&gt;set('entity', $entity);

  /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
  $form_display = \Drupal::service('entity_type.manager')-&gt;getStorage('entity_form_display')-&gt;load('node.node_type.default');
  $form_state-&gt;set('form_display', $form_display);

  foreach ($form_display-&gt;getComponents() as $name =&gt; $component) {
    $widget = $form_display-&gt;getRenderer($name);
    if (!$widget) {
      continue;
    }
    $items = $entity-&gt;get($name);
    $items-&gt;filterEmptyItems();
    $form[$name] = $widget-&gt;form($items, $form, $form_state);
    $form[$name]['#access'] = $items-&gt;access('edit');
    $form[$name]['#weight'] = $component['weight'];
  }

  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; 'submit',
  );
  return $form;
}

public function submitForm(array &amp;$form, FormStateInterface $form_state) {
  /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
  $form_display = $form_state-&gt;get('form_display');
  $entity = $form_state-&gt;get('entity');
  $form_display-&gt;extractFormValues($entity, $form, $form_state);
  $entity-&gt;save();
}