public function PickAccountsForm::buildForm in User Merge 2.x
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides MultiStepFormBase::buildForm
File
- src/
Form/ PickAccountsForm.php, line 83
Class
- PickAccountsForm
- Class PickAccountsForm.
Namespace
Drupal\usermerge\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$property = $this->reviewSwitcher
->getPropertyFromForm(static::class);
$form['properties']['list'] = [
'#theme' => 'item_list',
'#items' => $this
->getSupportedProperties(),
'#title' => $this
->t('Supported actions'),
];
$form['general']['retire'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'user',
'#selection_settings' => [
'include_anonymous' => FALSE,
],
'#title' => $this
->t('The name of the account you wish to retire'),
'#required' => TRUE,
'#default_value' => $this->multiStepStorage
->getRetiredAccount(),
];
$form['general']['retain'] = [
'#type' => 'entity_autocomplete',
'#target_type' => 'user',
'#selection_settings' => [
'include_anonymous' => FALSE,
],
'#title' => $this
->t('The name of the account you wish to keep'),
'#required' => TRUE,
'#default_value' => $this->multiStepStorage
->getRetainedAccount(),
];
$default_action = $this->multiStepStorage
->getValueFromStore($property, 'action');
if (is_null($default_action)) {
$default_action = 'action_block';
}
$form['general']['action'] = [
'#type' => 'select',
'#title' => $this
->t('Action to perform on the account you wish to retire'),
'#options' => $this
->getActionOptions(),
'#default_value' => $default_action,
];
return parent::buildForm($form, $form_state);
}