protected function FeedsParaMapperTestBase::createCT in Feeds Paragraphs 8
Utility function to create a content type.
Parameters
string $name: The content type name.
string $paragraph_field: The paragraph field name to add to the content type.
array $allowed_bundles: The allowed bundles for the paragraph field.
1 call to FeedsParaMapperTestBase::createCT()
- FeedsParaMapperTestBase::setUp in tests/
src/ Functional/ FeedsParaMapperTestBase.php
File
- tests/
src/ Functional/ FeedsParaMapperTestBase.php, line 165
Class
- FeedsParaMapperTestBase
- Test basic functionality via BrowserTestBase. @todo: tests are failing because some dependencies modules use PrivateTempStore, see https://www.drupal.org/project/feeds/issues/3012342 @todo: for now we applied the patch in the issue, waiting for module…
Namespace
Drupal\Tests\feeds_para_mapper\FunctionalCode
protected function createCT($name, $paragraph_field, array $allowed_bundles) {
parent::createContentType(array(
'type' => $name,
));
$fields = array();
$cardinality = $this->multiValuedParagraph ? -1 : 1;
$fields[$paragraph_field] = array(
'type' => "field_ui:entity_reference_revisions:paragraph",
'widget' => 'paragraphs_embed',
'cardinality' => $cardinality,
'bundles' => $allowed_bundles,
);
$path = "admin/structure/types/manage/{$name}/fields/add-field";
foreach ($fields as $field_name => $details) {
$this
->createField($path, $field_name, $details['cardinality'], $details['type'], $details['widget'], $details['bundles']);
}
}