function prepopulate_form_alter in Prepopulate 8.2
Same name and namespace in other branches
- 5 prepopulate.module \prepopulate_form_alter()
- 6.2 prepopulate.module \prepopulate_form_alter()
- 6 prepopulate.module \prepopulate_form_alter()
- 7.2 prepopulate.module \prepopulate_form_alter()
Implements hook_form_alter().
File
- ./
prepopulate.module, line 13 - Fill form elements with data from GET or POST values.
Code
function prepopulate_form_alter(&$form, FormStateInterface $form_state, $form_id) {
// If this is a subsequent step of a multi-step form, the prepopulate values
// have done their work, and the user may have modified them: bail.
if ($form_state
->isRebuilding()) {
return;
}
if (\Drupal::request()->query
->has('edit')) {
$form['#after_build'][] = 'prepopulate_after_build';
}
}