You are here

function dashboards_uninstall in Dashboards with Layout Builder 8

Same name and namespace in other branches
  1. 2.0.x dashboards.install \dashboards_uninstall()

Implements hook_uninstall().

File

./dashboards.install, line 11
Install, update, and uninstall functions for dashboards.module.

Code

function dashboards_uninstall() {

  /** @var \Drupal\user\UserDataInterface $userData */
  $userData = \Drupal::service('user.data');
  $userData
    ->delete('dashboards');

  /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $manager */
  $manager = \Drupal::service('entity_type.manager');
  $boards = $manager
    ->getStorage('dashboard')
    ->loadMultiple();
  $manager
    ->getStorage('dashboard')
    ->delete($boards);
}