protected function BlockContentTestBase::createBlockContentType in Zircon Profile 8.0
Same name in this branch
- 8.0 core/modules/block_content/src/Tests/BlockContentTestBase.php \Drupal\block_content\Tests\BlockContentTestBase::createBlockContentType()
- 8.0 core/modules/block_content/src/Tests/Views/BlockContentTestBase.php \Drupal\block_content\Tests\Views\BlockContentTestBase::createBlockContentType()
Same name and namespace in other branches
- 8 core/modules/block_content/src/Tests/BlockContentTestBase.php \Drupal\block_content\Tests\BlockContentTestBase::createBlockContentType()
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.
5 calls to BlockContentTestBase::createBlockContentType()
- BlockContentTestBase::setUp in core/
modules/ block_content/ src/ Tests/ BlockContentTestBase.php - Sets the test up.
- BlockContentTypeTest::testBlockContentTypeCreation in core/
modules/ block_content/ src/ Tests/ BlockContentTypeTest.php - Tests creating a block type programmatically and via a form.
- BlockContentTypeTest::testBlockContentTypeDeletion in core/
modules/ block_content/ src/ Tests/ BlockContentTypeTest.php - Tests deleting a block type that still has content.
- BlockContentTypeTest::testBlockContentTypeEditing in core/
modules/ block_content/ src/ Tests/ BlockContentTypeTest.php - Tests editing a block type using the UI.
- BlockContentTypeTest::testsBlockContentAddTypes in core/
modules/ block_content/ src/ Tests/ BlockContentTypeTest.php - Tests that redirects work as expected when multiple block types exist.
File
- core/
modules/ block_content/ src/ Tests/ BlockContentTestBase.php, line 103 - Contains \Drupal\block_content\Tests\BlockContentTestBase.
Class
- BlockContentTestBase
- Sets up block content types.
Namespace
Drupal\block_content\TestsCode
protected function createBlockContentType($label, $create_body = FALSE) {
$bundle = entity_create('block_content_type', array(
'id' => $label,
'label' => $label,
'revision' => FALSE,
));
$bundle
->save();
if ($create_body) {
block_content_add_body_field($bundle
->id());
}
return $bundle;
}