public function LaunchImportForm::buildForm in Content Synchronizer 3.x
Same name and namespace in other branches
- 8.2 src/Form/LaunchImportForm.php \Drupal\content_synchronizer\Form\LaunchImportForm::buildForm()
- 8 src/Form/LaunchImportForm.php \Drupal\content_synchronizer\Form\LaunchImportForm::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/ LaunchImportForm.php, line 33
Class
- LaunchImportForm
- Launch Import Form.
Namespace
Drupal\content_synchronizer\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
/** @var \Drupal\content_synchronizer\Entity\ImportEntity $import */
$this->import = $form_state
->getBuildInfo()['import'];
if ($this->import
->getProcessingStatus() === ImportEntity::STATUS_NOT_STARTED) {
// Settings.
$form['settings'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Settings'),
];
$form['settings']['creationType'] = [
'#type' => 'radios',
'#title' => $this
->t('Action on entity creation'),
'#options' => static::getCreateOptions(),
'#default_value' => ImportProcessor::DEFAULT_PUBLICATION_TYPE,
];
$form['settings']['updateType'] = [
'#type' => 'radios',
'#title' => $this
->t('Action on entity update'),
'#options' => static::getUpdateOptions(),
'#default_value' => ImportProcessor::DEFAULT_UPDATE_TYPE,
];
}
// Entity list.
$this
->initRootEntitiesList($form);
if ($this->import
->getProcessingStatus() === ImportEntity::STATUS_NOT_STARTED) {
$form['launch'] = [
'#type' => 'submit',
'#value' => $this
->t('Import selected entities'),
'#button_type' => 'primary',
];
}
return $form;
}