You are here

public function FillPdfFormDuplicateForm::buildForm in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x src/Form/FillPdfFormDuplicateForm.php \Drupal\fillpdf\Form\FillPdfFormDuplicateForm::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 ContentEntityConfirmFormBase::buildForm

File

src/Form/FillPdfFormDuplicateForm.php, line 46

Class

FillPdfFormDuplicateForm
Form controller for the FillPdfForm duplicate form.

Namespace

Drupal\fillpdf\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $label = trim($this
    ->getEntity()
    ->label()) ?: $this
    ->t('unnamed');
  $form['new_admin_title'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Administrative title'),
    '#required' => TRUE,
    '#size' => 32,
    '#maxlength' => 255,
    '#default_value' => $this
      ->t('Duplicate of @label', [
      '@label' => $label,
    ]),
  ];
  return $form;
}