public function ImportConfigForm::buildForm in GatherContent 8.4
Same name and namespace in other branches
- 8.5 src/Form/ImportConfigForm.php \Drupal\gathercontent\Form\ImportConfigForm::buildForm()
- 8.3 src/Form/ImportConfigForm.php \Drupal\gathercontent\Form\ImportConfigForm::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 ConfigFormBase::buildForm
File
- src/
Form/ ImportConfigForm.php, line 35
Class
- ImportConfigForm
- Class ImportConfigForm.
Namespace
Drupal\gathercontent\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('gathercontent.import');
$form['node_default_status'] = [
'#type' => 'radios',
'#required' => TRUE,
'#title' => $this
->t('Node default status'),
'#default_value' => $config
->get('node_default_status'),
'#options' => [
0 => $this
->t('Unpublished'),
1 => $this
->t('Published'),
],
];
$form['node_update_method'] = [
'#type' => 'radios',
'#required' => TRUE,
'#title' => $this
->t('Content update method'),
'#default_value' => $config
->get('node_update_method'),
'#options' => [
NodeUpdateMethod::ALWAYS_CREATE => $this
->t('Always create new Content'),
NodeUpdateMethod::UPDATE_IF_NOT_CHANGED => $this
->t('Create new Content if it has changed since the last import'),
NodeUpdateMethod::ALWAYS_UPDATE => $this
->t('Always update existing Content'),
],
];
$form['node_create_new_revision'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Create new revision'),
'#default_value' => $config
->get('node_create_new_revision'),
'#description' => $this
->t('If the "Content update method" is any other than "Always update existing Content" then this setting won\'t take effect, because the entity will always be new.'),
];
return parent::buildForm($form, $form_state);
}