BlockContentForm::prepareEntity

protected 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 86

Class

BlockContentForm
Form handler for the custom block edit forms.

Namespace

Drupal\block_content

Code

1
2
3
4
5
6
7
8
9
10
protected function prepareEntity() {
  $block = $this->entity;
  // Set up default values, if required.
  $block_type = $this->blockContentTypeStorage->load($block->bundle());
  if (!$block->isNew()) {
    $block->setRevisionLogMessage(NULL);
  }
  // Always use the default revision setting.
  $block->setNewRevision($block_type->shouldCreateNewRevision());
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.