function ShortcutHooks::userDelete

Same name and namespace in other branches
  1. 11.x core/modules/shortcut/src/Hook/ShortcutHooks.php \Drupal\shortcut\Hook\ShortcutHooks::userDelete()

Implements hook_ENTITY_TYPE_delete().

Attributes

#[Hook('user_delete')]

File

core/modules/shortcut/src/Hook/ShortcutHooks.php, line 134

Class

ShortcutHooks
Hook implementations for shortcut.

Namespace

Drupal\shortcut\Hook

Code

public function userDelete(EntityInterface $entity) : void {
  // Clean up shortcut set mapping of removed user account.
  \Drupal::entityTypeManager()->getStorage('shortcut_set')
    ->unassignUser($entity);
}

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