How do I access values using kint()? I am porting a module from Drupal 7 to Drupal 8. I was debugging using kint().

I am using hook_user_presave($account) and trying to access the values of $account using kint($account).



kint() is very confusing, compared to dsm() in Drupal 7.

How do I access values using kint()?
You can get the user entity from the proxy with AccountProxy::getAccount:

$entity = $account-&gt;getAccount();


And then the roles with User::getRoles:

$roles = $entity-&gt;getRoles;


If you don't need the entity for anything else in that method, it turns into a one-liner:

$roles = $account-&gt;getAccount()-&gt;getRoles();