// Caching is normally done in self::processForm(), but what needs to be
// cached is the $form structure before it passes through
// self::doBuildForm(), so we need to do it here.
// @todo For Drupal 8, find a way to avoid this code duplication.
if ($form_state->
isCached()) { $this->
setCache($form['#build_id'
],
$form,
$form_state);
} // Clear out all group associations as these might be different when
// re-rendering the form.
$form_state->
setGroups([]);
// Return a fully built form that is ready for rendering.
return $this->
doBuildForm($form_id,
$form,
$form_state);
} /**
* {@inheritdoc}
*/
public function getCache($form_build_id, FormStateInterface
$form_state) { return $this->formCache->
getCache($form_build_id,
$form_state);
}