You are here

public function Menu::delete in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Entity/Menu.php \Drupal\system\Entity\Menu::delete()
  2. 9 core/modules/system/src/Entity/Menu.php \Drupal\system\Entity\Menu::delete()

Deletes an entity permanently.

Throws

\Drupal\Core\Entity\EntityStorageException In case of failures an exception is thrown.

Overrides EntityBase::delete

File

core/modules/system/src/Entity/Menu.php, line 112

Class

Menu
Defines the Menu configuration entity class.

Namespace

Drupal\system\Entity

Code

public function delete() {
  parent::delete();
  \Drupal::cache('menu')
    ->invalidateAll();

  // Invalidate the block cache to update menu-based derivatives.
  if (\Drupal::moduleHandler()
    ->moduleExists('block')) {
    \Drupal::service('plugin.manager.block')
      ->clearCachedDefinitions();
  }
}