You are here

public function NodeExportConfigForm::buildForm in Node export 8

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/NodeExportConfigForm.php, line 38

Class

NodeExportConfigForm
Provides a Node Export form.

Namespace

Drupal\node_Export\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('node_export.settings');
  $form['basic'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('General settings'),
  ];
  $form['basic']['node_export_format'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Format to use when exporting a node'),
    '#default_value' => 'JSON',
    '#options' => [
      'JSON' => $this
        ->t('JSON'),
    ],
    '#description' => $this
      ->t("Right Now we use only JSON Foramt."),
  ];
  $form['basic']['node_export_existing'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('When importing a node that already exists'),
    '#options' => [
      'new' => $this
        ->t('Create a new node'),
      'replace' => $this
        ->t('Create a new revision of the existing node'),
      'skip' => $this
        ->t('Skip the node'),
    ],
    '#description' => $this
      ->t('UUIDs are used to uniquely identify nodes.'),
    '#default_value' => $config
      ->get('node_export_import'),
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Save Configuration'),
  ];
  return $form;
}