You are here

public function PopulateForm::buildForm in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_import/src/Form/PopulateForm.php \Drupal\bibcite_import\Form\PopulateForm::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

modules/bibcite_import/src/Form/PopulateForm.php, line 77

Class

PopulateForm
Populate values to Reference form.

Namespace

Drupal\bibcite_import\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['format'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Format'),
    '#options' => array_map(function ($definition) {
      return $definition['label'];
    }, $this->formatManager
      ->getImportDefinitions()),
    '#required' => TRUE,
  ];
  $form['data'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Paste your bibliographic entry here'),
    '#description' => $this
      ->t('If you paste multiple entries first will be used.'),
    '#rows' => 20,
    '#required' => TRUE,
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Populate'),
  ];
  return $form;
}