public function VocabularySelectForm::buildForm in WordPress Migrate 8.3
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
- wordpress_migrate_ui/
src/ Form/ VocabularySelectForm.php, line 24
Class
- VocabularySelectForm
- Simple wizard step form.
Namespace
Drupal\wordpress_migrate_ui\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// Start clean in case we came here via Previous.
$cached_values = $form_state
->getTemporaryValue('wizard');
unset($cached_values['tag_vocabulary']);
unset($cached_values['category_vocabulary']);
$form_state
->setTemporaryValue('wizard', $cached_values);
$form['overview'] = [
'#markup' => $this
->t('WordPress blogs contain two vocabularies, tags and categories. Here you may choose the Drupal vocabularies to import each into, or omit one or both from the import entirely.'),
];
// Get destination node type(s)
$vocabularies = Vocabulary::loadMultiple();
$options = [
'' => $this
->t('Do not import'),
];
foreach ($vocabularies as $vocabulary_id => $info) {
$options[$vocabulary_id] = $info
->label();
}
$form['tag_vocabulary'] = [
'#type' => 'select',
'#title' => $this
->t('Import WordPress tags as'),
'#options' => $options,
];
$form['category_vocabulary'] = [
'#type' => 'select',
'#title' => $this
->t('Import WordPress categories as'),
'#options' => $options,
];
return $form;
}