protected function BlockContentTranslationUITest::createBlockContent in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/block_content/src/Tests/BlockContentTranslationUITest.php \Drupal\block_content\Tests\BlockContentTranslationUITest::createBlockContent()
Creates a custom block.
Parameters
bool|string $title: (optional) Title of block. When no value is given uses a random name. Defaults to FALSE.
bool|string $bundle: (optional) Bundle name. When no value is given, defaults to $this->bundle. Defaults to FALSE.
Return value
\Drupal\block_content\Entity\BlockContent Created custom block.
1 call to BlockContentTranslationUITest::createBlockContent()
- BlockContentTranslationUITest::testDisabledBundle in core/
modules/ block_content/ src/ Tests/ BlockContentTranslationUITest.php - Test that no metadata is stored for a disabled bundle.
File
- core/
modules/ block_content/ src/ Tests/ BlockContentTranslationUITest.php, line 96 - Contains \Drupal\block_content\Tests\BlockContentTranslationUITest.
Class
- BlockContentTranslationUITest
- Tests the block content translation UI.
Namespace
Drupal\block_content\TestsCode
protected function createBlockContent($title = FALSE, $bundle = FALSE) {
$title = $title ?: $this
->randomMachineName();
$bundle = $bundle ?: $this->bundle;
$block_content = entity_create('block_content', array(
'info' => $title,
'type' => $bundle,
'langcode' => 'en',
));
$block_content
->save();
return $block_content;
}