Sets the Paragraphs widget add mode.
string $content_type: Content type name where to set the widget mode.
string $paragraphs_field: Paragraphs field to change the mode.
string $mode: Mode to be set. ('dropdown', 'select' or 'button').
protected function setAddMode($content_type, $paragraphs_field, $mode) {
$form_display = EntityFormDisplay::load('node.' . $content_type . '.default')
->setComponent($paragraphs_field, [
'type' => 'entity_reference_paragraphs',
'settings' => [
'add_mode' => $mode,
],
]);
$form_display
->save();
}