Test if a value exists in $form_state If I wanted to rebuild a form in Drupal 7, conditional on the state of the form, I would do something like this:

if (isset($form_state['values']['foo'])) {
  $form['...
}


Now, $form_state is an object in Drupal 8. What would be the best equivalent?
Pretty much $form_state-&gt;getValue('foo');.

See the docs page for getValue.