In my user entity, I have a term reference. In that vocabulary, I have a regular field. How can I fetch that field's value? I tried the below in devel/php to no avail.
$user = Drupal\user\Entity\User::load(17); $dept = $user->field_department->entity; \dpm($dept->field_administrator_e_mail->value);
My end goal is to send the email to the department's administrator when a user is created.
UPDATE: I also tried the below:
$user = Drupal\user\Entity\User::load(17); $dept = $user->field_department; \dpm($dept->name);