- Issue created by @joey-santiago
- @joey-santiago opened merge request.
- 🇮🇳India omkar_yewale Mumbai
Hi @joey-santiago,
While reviewing the MR, I realized there were a few possible changes we can do./user_delete_reassign/src/Form/UserDeleteReassignConfigForm.php
$roles = user_role_names(TRUE); foreach ($roles as $id => $val) { $roles[$id] = Html::escape($val); }
To
use Drupal\user\Entity\Role; $roles = Role::loadMultiple(); foreach ($roles as $id => $role) { if ($id !== 'anonymous') { $roles[$id] = Html::escape($role->label()); } }
/user_delete_reassign/user_delete_reassign.module
$nodes = \Drupal::entityQuery('node') ->condition('uid', $account->id()) ->execute(); node_mass_update($nodes, ['uid' => $new_user->id()], NULL, TRUE);
To
use use Drupal\Core\Entity\EntityTypeManagerInterface; $nodeStorage = \Drupal::service('entity_type.manager')->getStorage('node'); $nodes = $nodeStorage->getQuery() ->condition('uid', $account->id()) ->execute(); $nodeStorage->updateMultiple($nodes, ['uid' => $new_user->id()], NULL, TRUE);