Display a block based on current select option I have a select field that holds two options. When the second option is chosen, I want to display a block.

I know that with form API I should be able to do this. I'm just not sure on where to start. Any help getting me going would be greatly appreciated.

So far I have the code below.

function MODULE_form_user_register_form_alter(&amp;$form, &amp;$form_state, $form_id) {
    $form['account']['type'] = [
      '#title' =&gt; 'I am ordering for',
      '#type' =&gt; 'select',
      '#options' =&gt; [ 'Myself' =&gt; 'Myself', 'Someone' =&gt; 'Someone else' ],
      '#weight' =&gt; -100
      ];
}
Don't try to add the fields in a form alter hook. Do this in the field UI of the user entity /admin/config/people/accounts/fields. To change the visibility of fields dependending on the content of another field use

Conditional Fields

or the Form #states API directly, see How can I hide or show fields using states with hook form alter.

EDIT: The form #states api did the trick.