public function MetaTagUploadForm::buildForm in Metatag Import Export CSV 8
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/ MetaTagUploadForm.php, line 24
Class
- MetaTagUploadForm
- Form for uploading csv.
Namespace
Drupal\metatag_import_export_csv\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['upload_file'] = [
'#type' => 'managed_file',
'#title' => $this
->t('Upload file'),
'#required' => TRUE,
'#description' => t('Allowed extensions: csv'),
'#upload_location' => 'public://metatag_import_export_csv/',
'#upload_validators' => [
'file_validate_extensions' => [
'csv',
],
'validate_csv_header' => [],
],
];
$form['submit'] = [
'#type' => 'submit',
'#required' => TRUE,
'#value' => $this
->t("Import"),
];
return $form;
}