function ShortcutHooks::userDelete

Implements hook_ENTITY_TYPE_delete().

File

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

Class

ShortcutHooks
Hook implementations for shortcut.

Namespace

Drupal\shortcut\Hook

Code

public function userDelete(EntityInterface $entity) {
    // 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.