public function ExportForm::buildForm in Term CSV Export Import 8.3
Same name and namespace in other branches
- 8 src/Form/ExportForm.php \Drupal\term_csv_export_import\Form\ExportForm::buildForm()
- 8.2 src/Form/ExportForm.php \Drupal\term_csv_export_import\Form\ExportForm::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/ ExportForm.php, line 59
Class
- ExportForm
- Class ExportForm.
Namespace
Drupal\term_csv_export_import\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
switch ($this->step) {
case 1:
$form['vocabulary'] = [
'#type' => 'select',
'#title' => $this
->t('Taxonomy'),
'#options' => taxonomy_vocabulary_get_names(),
];
$form['include_ids'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Include Term Ids in export.'),
];
$form['include_headers'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Include Term Headers in export.'),
];
$form['include_additional_fields'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Include extra fields in export.'),
'#description' => $this
->t('Note that fields are stringified using <a href="http://www.php.net/http_build_query">http_build_query</a>'),
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Export'),
];
break;
case 2:
$form['input'] = [
'#type' => 'textarea',
'#title' => $this
->t('CSV Data'),
'#description' => $this
->t('The formatted term data'),
'#value' => $this->getExport,
];
break;
}
return $form;
}