You are here

public function ImportModuleForm::buildForm in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/Form/ImportModuleForm.php \Drupal\opigno_module\Form\ImportModuleForm::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/ImportModuleForm.php, line 36

Class

ImportModuleForm
Import Module form.

Namespace

Drupal\opigno_module\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $mode = NULL) {
  $form['module_opi'] = [
    '#title' => $this
      ->t('Module'),
    '#type' => 'file',
    '#description' => $this
      ->t('Here you can import module. 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;
}