You are here

protected function ParagraphsTestBase::setAllowedParagraphsTypes in Paragraphs 8

Sets the allowed Paragraphs types that can be added.

Parameters

string $content_type: Content type name that contains the paragraphs field.

array $paragraphs_types: Array of paragraphs types that will be modified.

bool $selected: Whether or not the paragraphs types will be enabled.

string $paragraphs_field: Paragraphs field name that does the reference.

4 calls to ParagraphsTestBase::setAllowedParagraphsTypes()
ParagraphsAddModesTest::testDropDownMode in tests/src/Functional/WidgetLegacy/ParagraphsAddModesTest.php
Tests the add drop down button.
ParagraphsAddModesTest::testDropDownMode in tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the add drop down button.
ParagraphsAddModesTest::testSelectMode in tests/src/Functional/WidgetLegacy/ParagraphsAddModesTest.php
Tests the add select mode.
ParagraphsAddModesTest::testSelectMode in tests/src/Functional/WidgetStable/ParagraphsAddModesTest.php
Tests the add select mode.

File

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

Class

ParagraphsTestBase
Base class for tests.

Namespace

Drupal\Tests\paragraphs\Functional\WidgetLegacy

Code

protected function setAllowedParagraphsTypes($content_type, $paragraphs_types, $selected, $paragraphs_field) {
  $edit = [];
  $this
    ->drupalGet('admin/structure/types/manage/' . $content_type . '/fields/node.' . $content_type . '.' . $paragraphs_field);
  foreach ($paragraphs_types as $paragraphs_type) {
    $edit['settings[handler_settings][target_bundles_drag_drop][' . $paragraphs_type . '][enabled]'] = $selected;
  }
  $this
    ->submitForm($edit, 'Save settings');
}