You are here

protected function ContentLockBlockTest::createBlockContentType in Content locking (anti-concurrent editing) 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/ContentLockBlockTest.php \Drupal\Tests\content_lock\Functional\ContentLockBlockTest::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 ContentLockBlockTest::createBlockContentType()
ContentLockBlockTest::testContentLockBlock in tests/src/Functional/ContentLockBlockTest.php
Test simultaneous edit on block.

File

tests/src/Functional/ContentLockBlockTest.php, line 63

Class

ContentLockBlockTest
Block tests.

Namespace

Drupal\Tests\content_lock\Functional

Code

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;
}