You are here

protected function ParagraphsTestBase::setParagraphsWidgetMode in Paragraphs 8

Sets the Paragraphs widget display mode.

Parameters

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.

8 calls to ParagraphsTestBase::setParagraphsWidgetMode()
ParagraphsBehaviorsTest::testCollapsedSummary in tests/src/Functional/WidgetStable/ParagraphsBehaviorsTest.php
Tests the behavior plugins summary for paragraphs closed mode.
ParagraphsDuplicateFeatureTest::testDuplicateButtonWithNesting in tests/src/Functional/WidgetStable/ParagraphsDuplicateFeatureTest.php
Tests duplicate paragraph feature with nested paragraphs.
ParagraphsInlineEntityFormTest::testParagraphsIEFChangeOrder in tests/src/Functional/WidgetLegacy/ParagraphsInlineEntityFormTest.php
Tests the reordering of previewed paragraphs.
ParagraphsInlineEntityFormTest::testParagraphsIEFPreview in tests/src/Functional/WidgetLegacy/ParagraphsInlineEntityFormTest.php
Tests the revision of paragraphs.
ParagraphsWidgetButtonsTest::testButtonsVisibility in tests/src/Functional/WidgetStable/ParagraphsWidgetButtonsTest.php
Tests if buttons are present for each widget mode.

... See full list

File

tests/src/Functional/WidgetLegacy/ParagraphsTestBase.php, line 201

Class

ParagraphsTestBase
Base class for tests.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetLegacy

Code

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');
}