protected function ParagraphsTestBase::setAddMode in Paragraphs 8
Same name in this branch
- 8 tests/src/Functional/WidgetLegacy/ParagraphsTestBase.php \Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsTestBase::setAddMode()
- 8 tests/src/Functional/WidgetStable/ParagraphsTestBase.php \Drupal\Tests\paragraphs\Functional\WidgetStable\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').
Overrides ParagraphsTestBase::setAddMode
2 calls to ParagraphsTestBase::setAddMode()
- ParagraphsAddModesTest::testDropDownMode in tests/
src/ Functional/ WidgetStable/ ParagraphsAddModesTest.php - Tests the add drop down button.
- ParagraphsAddModesTest::testSelectMode in tests/
src/ Functional/ WidgetStable/ ParagraphsAddModesTest.php - Tests the add select mode.
File
- tests/
src/ Functional/ WidgetStable/ ParagraphsTestBase.php, line 26
Class
- ParagraphsTestBase
- Base class for tests.
Namespace
Drupal\Tests\paragraphs\Functional\WidgetStableCode
protected function setAddMode($content_type, $paragraphs_field, $mode) {
$form_display = EntityFormDisplay::load('node.' . $content_type . '.default')
->setComponent($paragraphs_field, [
'type' => 'paragraphs',
'settings' => [
'add_mode' => $mode,
],
]);
$form_display
->save();
}