public function ContentImport::buildForm in Content Import 8
Same name and namespace in other branches
- 8.9 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::buildForm()
- 8.3 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::buildForm()
- 8.4 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::buildForm()
Content Import Form.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ ContentImport.php, line 47 - Contains \Drupal\contentimport\Form\ContentImport.
Class
- ContentImport
- Configure Content Import settings for this site.
Namespace
Drupal\contentimport\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$ContentTypes = ContentImportController::getAllContentTypes();
$selected = 0;
$form['contentimport_contenttype'] = [
'#type' => 'select',
'#title' => $this
->t('Select Content Type'),
'#options' => $ContentTypes,
'#default_value' => $selected,
];
$form['file_upload'] = [
'#type' => 'managed_file',
'#title' => t('Import CSV File'),
'#size' => 40,
'#description' => t('Select the CSV file to be imported. '),
'#required' => FALSE,
'#autoupload' => TRUE,
'#upload_validators' => array(
'file_validate_extensions' => array(
'csv',
),
),
];
$form['submit'] = [
'#type' => 'submit',
'#value' => t('Import'),
'#button_type' => 'primary',
];
return parent::buildForm($form, $form_state);
}