public function ImportActivityForm::buildForm in Opigno module 8
Same name and namespace in other branches
- 3.x src/Form/ImportActivityForm.php \Drupal\opigno_module\Form\ImportActivityForm::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/ ImportActivityForm.php, line 34
Class
- ImportActivityForm
- Import Activity form.
Namespace
Drupal\opigno_module\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $mode = NULL) {
$is_ppt = $mode && $mode == 'ppt' ? TRUE : FALSE;
if ($is_ppt) {
$form_state
->set('mode', $mode);
}
$form['activity_opi'] = [
'#title' => $this
->t('Activity'),
'#type' => 'file',
'#description' => $this
->t('Here you can import activity. 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;
}