public function ImportForm::buildForm in Taxonomy Import 8
Same name and namespace in other branches
- 2.x src/Form/ImportForm.php \Drupal\taxonomy_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
- src/
Form/ ImportForm.php, line 34 - Contains \Drupal\taxonomy_import\Form\ImportForm.
Class
- ImportForm
- Contribute form.
Namespace
Drupal\taxonomy_import\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['field_vocabulary_name'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Vocabulary name'),
'#required' => TRUE,
'#maxlength_js' => TRUE,
'#maxlength' => 30,
'#description' => t('Not more than 30 characters please!'),
);
$form['taxonomy_file'] = array(
'#type' => 'managed_file',
'#title' => $this
->t('Import file'),
'#required' => TRUE,
'#upload_validators' => array(
'file_validate_extensions' => array(
'csv xml',
),
'file_validate_size' => array(
25600000,
),
),
'#upload_location' => 'public://taxonomy_files/',
'#description' => t('Upload a file to Import taxonomy!'),
);
$form['actions']['#type'] = 'actions';
$form['submit'] = array(
'#type' => 'submit',
'#value' => $this
->t('Import'),
'#button_type' => 'primary',
);
return $form;
}