You are here

public function OgMenu::delete in Organic Groups Menu (OG Menu) 8

Deletes an entity permanently.

Throws

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

Overrides EntityBase::delete

File

src/Entity/OgMenu.php, line 80

Class

OgMenu
Defines the OG Menu entity.

Namespace

Drupal\og_menu\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();
  }
}