How does the register form in the user module load ImageWidget?

enter image description here I want to use the user picture widget on the user register form to capture an image. So for my custom entity form I’m using the managed_file as such modules/custom_module/src/CustomEntityForm.php

public function form(array $  form, FormStateInterface $  form_state) {       $  form['deal']['image'] = array(           '#type' => 'managed_file', ... 

the above code does not add the widget as seen on the register form, i.e It does not have the preview functionality widget which I think it comes from the image widget.

This line seems to be responsible for the output of the widget on the register form ContentEntityForm.php Line 122

public function form(array $  form, FormStateInterface $  form_state) { $  this->getFormDisplay($  form_state)->buildForm($  this->entity, $  form, $  form_state); 

after buildForm() the $ form array has a new inner array keyed ‘user_picture’. This is var_dump

 'user_picture' =>      array (size=7)       '#type' => string 'container' (length=9)       '#parents' =>          array (size=1)           0 => string 'user_picture_wrapper' (length=20)       '#attributes' =>          array (size=1)           'class' =>              array (size=3)               ...       'widget' =>          array (size=6)           0 =>              array (size=28)               ...           '#after_build' =>              array (size=1)               ...           '#field_name' => string 'user_picture' (length=12)           '#field_parents' =>              array (size=0)               ...           '#parents' =>              array (size=1)               ...           '#tree' => boolean true       '#access' => boolean true       '#weight' => int -1       '#cache' =>  

this is way up in the core code. how does the user module configure all this to use imageWidget? Do I need to configure something for EntityFormDsiplay?