protected function ParagraphsTestBase::setAddMode

Same name in this branch
  1. 8.x-1.x paragraphs/tests/src/Functional/WidgetStable/ParagraphsTestBase.php \Drupal\Tests\paragraphs\Functional\WidgetStable\ParagraphsTestBase::setAddMode()
  2. 8.x-1.x paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsTestBase.php \Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsTestBase::setAddMode()

Sets the Paragraphs widget add 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. ('dropdown', 'select' or 'button').

2 calls to ParagraphsTestBase::setAddMode()
ParagraphsAddModesTest::testDropDownMode in paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsAddModesTest.php
Tests the add drop down button.
ParagraphsAddModesTest::testSelectMode in paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsAddModesTest.php
Tests the add select mode.
1 method overrides ParagraphsTestBase::setAddMode()
ParagraphsTestBase::setAddMode in paragraphs/tests/src/Functional/WidgetStable/ParagraphsTestBase.php
Sets the Paragraphs widget add mode.

File

paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsTestBase.php, line 107

Class

ParagraphsTestBase
Base class for tests.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetLegacy

Code

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