public function ImportTrainingForm::buildForm in Opigno module 8
Same name and namespace in other branches
- 3.x src/Form/ImportTrainingForm.php \Drupal\opigno_module\Form\ImportTrainingForm::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
- src/
Form/ ImportTrainingForm.php, line 88
Class
- ImportTrainingForm
- Import Course form.
Namespace
Drupal\opigno_module\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $mode = NULL) {
$form['training_opi'] = [
'#title' => $this
->t('Training'),
'#type' => 'file',
'#description' => $this
->t('Here you can import training. Allowed extension: opi'),
];
$ajax_id = "ajax-form-entity-external-package";
$form['#attributes']['class'][] = $ajax_id;
$form['#attached']['library'][] = 'opigno_module/ajax_form';
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Import'),
];
return $form;
}