public function ContentImport::buildForm in Content Import 8.4
Same name and namespace in other branches
- 8.9 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::buildForm()
- 8 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::buildForm()
- 8.3 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::buildForm()
Content Import Form.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ ContentImport.php, line 39
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' => 'file',
'#title' => $this
->t('Import CSV File'),
'#size' => 40,
'#description' => $this
->t('Select the CSV file to be imported.'),
'#required' => FALSE,
'#autoupload' => TRUE,
'#upload_validators' => [
'file_validate_extensions' => [
'csv',
],
],
];
$form['loglink'] = [
'#type' => 'link',
'#title' => $this
->t('Check Log..'),
'#url' => Url::fromUri('base:sites/default/files/contentimportlog.txt'),
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Import'),
'#button_type' => 'primary',
];
return parent::buildForm($form, $form_state);
}