You are here

protected function BlockContentForm::prepareEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block_content/src/BlockContentForm.php \Drupal\block_content\BlockContentForm::prepareEntity()

Overrides \Drupal\Core\Entity\EntityForm::prepareEntity().

Prepares the custom block object.

Fills in a few default values, and then invokes hook_block_content_prepare() on all modules.

Overrides EntityForm::prepareEntity

File

core/modules/block_content/src/BlockContentForm.php, line 91
Contains \Drupal\block_content\BlockContentForm.

Class

BlockContentForm
Form controller for the custom block edit forms.

Namespace

Drupal\block_content

Code

protected function prepareEntity() {
  $block = $this->entity;

  // Set up default values, if required.
  $block_type = $this->blockContentTypeStorage
    ->load($block
    ->bundle());
  if (!$block
    ->isNew()) {
    $block
      ->setRevisionLog(NULL);
  }

  // Always use the default revision setting.
  $block
    ->setNewRevision($block_type
    ->shouldCreateNewRevision());
}