protected function PerBlockTypeSettingsTest::createBlockContentType in Simplify 8
Creates a custom block type (bundle).
Parameters
string $label: The block type label.
bool $create_body: Whether or not to create the body field.
Return value
\Drupal\block_content\Entity\BlockContentType Created custom block type.
1 call to PerBlockTypeSettingsTest::createBlockContentType()
File
- src/
Tests/ PerBlockTypeSettingsTest.php, line 134
Class
- PerBlockTypeSettingsTest
- Test simplify per block-type settings.
Namespace
Drupal\simplify\TestsCode
protected function createBlockContentType($label, $create_body = FALSE) {
$bundle = BlockContentType::create([
'id' => $label,
'label' => $label,
'revision' => TRUE,
]);
$bundle
->save();
if ($create_body) {
block_content_add_body_field($bundle
->id());
}
return $bundle;
}