I have installed the Profile module. I am trying to programmatically load profiles. The code works, but I am not able to access any field value.
class IdCardController extends ControllerBase {
/**
* Init id card download.
*/
public function initDownload(User $user) {
$user_profile = $this->entityTypeManager()->getStorage('profile')->loadByProperties([
'uid' => $user->id(),
'type' => 'personal_information',
]);
kint($user_profile);
}
}
Using kint()
, I can see all methods are protected.