function QuickEditIntegrationTest::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.
1 call to QuickEditIntegrationTest::createBlockContentType()
- QuickEditIntegrationTest::testCustomBlockLinks in core/
modules/ settings_tray/ tests/ src/ FunctionalJavascript/ QuickEditIntegrationTest.php - Tests that contextual links in custom blocks are changed.
File
-
core/
modules/ settings_tray/ tests/ src/ FunctionalJavascript/ QuickEditIntegrationTest.php, line 199
Class
- QuickEditIntegrationTest
- Test Settings Tray and Quick Edit modules integration.
Namespace
Drupal\Tests\settings_tray\FunctionalJavascriptCode
protected function createBlockContentType($label, $create_body = FALSE) {
$bundle = BlockContentType::create([
'id' => $label,
'label' => $label,
'revision' => FALSE,
]);
$bundle->save();
if ($create_body) {
block_content_add_body_field($bundle->id());
}
return $bundle;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.