I'm trying to render a custom field that shows up on the user registration form on a separate new form that creates users of a particular role with specific permissions.
I have everything working except being able to render this custom field.
When I view the field under the user registration form settings page, it says it's an entity reference field. When it renders it has 4 check boxes.
I've figured out how to kint out the fields that are on the user registration form from my new form, but I can't figure out how to render the specific one that I need.
$entityTypeManager = \Drupal::service('entity_field.manager');
$fields = $entityTypeManager->getFieldDefinitions('user', 'user');
foreach ($fields as $field_name) {
kint($field_name);
}
That gives me a listing of all of the fields in the user registration.
I feel like I'm missing something very obvious.