public function ImportForm::buildForm in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_import/src/Form/ImportForm.php \Drupal\bibcite_import\Form\ImportForm::buildForm()
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 FormInterface::buildForm
File
- modules/
bibcite_import/ src/ Form/ ImportForm.php, line 63
Class
- ImportForm
- Common import form.
Namespace
Drupal\bibcite_import\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['file'] = [
'#type' => 'file',
'#title' => $this
->t('File'),
'#multiple' => FALSE,
];
$form['format'] = [
'#type' => 'select',
'#title' => $this
->t('Format'),
'#options' => array_map(function ($definition) {
return $definition['label'];
}, $this->formatManager
->getImportDefinitions()),
'#required' => TRUE,
];
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Import'),
];
return $form;
}