You are here

public function ImportConfigForm::buildForm in GatherContent 8.3

Same name and namespace in other branches
  1. 8.5 src/Form/ImportConfigForm.php \Drupal\gathercontent\Form\ImportConfigForm::buildForm()
  2. 8.4 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 34

Class

ImportConfigForm
Class ImportConfigForm.

Namespace

Drupal\gathercontent\Form

Code

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' => [
      'always_create' => $this
        ->t('Always create new Content'),
      'update_if_not_changed' => $this
        ->t('Create new Content if it has changed since the last import'),
      'always_update' => $this
        ->t('Always update existing Content'),
    ],
  ];
  return parent::buildForm($form, $form_state);
}