You are here

public function ConfigForm::buildForm in PDF 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/ConfigForm.php, line 32

Class

ConfigForm
Class ConfigForm.

Namespace

Drupal\pdf\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('pdf.settings');
  $form['custom_viewer'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Path to custom viewer.html file'),
    '#description' => $this
      ->t('Specify a custom viewer.html file. This should be a full path starting with a slash. If left empty, the default viewer.html file will be used.'),
    '#maxlength' => 255,
    '#size' => 64,
    '#default_value' => $config
      ->get('custom_viewer'),
    '#attributes' => [
      'placeholder' => $this
        ->t('example: /sites/default/themes/yourtheme/pdfjs/viewer.html'),
    ],
  ];
  return parent::buildForm($form, $form_state);
}