Actually it is pretty simple. I have written a module with the following hook:
Hope that helps somebody. Pretty handy and user friendly when it comes to content that is mainly created through paragraphs elements.
You attach the field widgets to the node when the add form is opened.
function xxx_entity_prepare_form(EntityInterface $entity, $operation, FormStateInterface $form_state) {
if("article" === $entity->bundle()){
$bundles = ['article_navigation_banner', 'call_to_action_banner', 'author_information'];
$entity_manager = \Drupal::entityManager();
$langcode = $form_state->get('langcode');
$field = $entity->get('field_ui_elements');
$target_type = $field->getSetting('target_type');
foreach ($bundles as $bundle_name) {
// Create paragraph and display.
$entity_type = $entity_manager->getDefinition($target_type);
$bundle_key = $entity_type->getKey('bundle');
$options = array(
$bundle_key => $bundle_name,
'langcode' => $langcode,
);
if("call_to_action_banner" === $bundle_name){
}
/** @var FieldableEntityInterface $paragraphs_entity */
$paragraphs_entity = $entity_manager->getStorage($target_type)->create($options);
// Field values.
$field->appendItem($paragraphs_entity);
}
}
}