public static function Dashboard::preDelete in Dashboards with Layout Builder 8
Same name and namespace in other branches
- 2.0.x src/Entity/Dashboard.php \Drupal\dashboards\Entity\Dashboard::preDelete()
Acts on entities before they are deleted and before hooks are invoked.
Used before the entities are deleted and before invoking the delete hook.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.
Overrides ConfigEntityBase::preDelete
File
- src/
Entity/ Dashboard.php, line 176
Class
- Dashboard
- Dashboard.
Namespace
Drupal\dashboards\EntityCode
public static function preDelete(EntityStorageInterface $storage, array $entities) {
/**
* @var \Drupal\user\UserDataInterface
*/
$userData = \Drupal::service('user.data');
foreach ($entities as $entity) {
$userData
->delete('dashboards', NULL, $entity
->id());
}
}