function BlockContentHooks::blockPreSave

Implements hook_ENTITY_TYPE_presave().

Attributes

#[Hook('block_presave')]

File

core/modules/block_content/src/Hook/BlockContentHooks.php, line 167

Class

BlockContentHooks
Hook implementations for block_content.

Namespace

Drupal\block_content\Hook

Code

public function blockPreSave(BlockInterface $block) : void {
  // Use an inline service since DI would require enabling the block module
  // in any Kernel test that installs block_content. This is BC code so will
  // be removed in Drupal 12 anyway.
  \Drupal::service(BlockConfigUpdater::class)->updateBlock($block);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.