Sets the Paragraphs widget display 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. ('closed', 'preview' or 'open'). 'preview' is only allowed in the legacy widget. Use setParagraphsWidgetSettings for the stable widget, instead.
protected function setParagraphsWidgetMode($content_type, $paragraphs_field, $mode) {
$this
->drupalGet('admin/structure/types/manage/' . $content_type . '/form-display');
$this
->submitForm([], $paragraphs_field . '_settings_edit');
$this
->submitForm([
'fields[' . $paragraphs_field . '][settings_edit_form][settings][edit_mode]' => $mode,
], 'Update');
$this
->submitForm([], 'Save');
}