You are here

public function WkhtmltopdfConfig::buildForm in wkhtmltopdf 8

Same name and namespace in other branches
  1. 2.0.x src/Form/WkhtmltopdfConfig.php \Drupal\wkhtmltopdf\Form\WkhtmltopdfConfig::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/WkhtmltopdfConfig.php, line 32

Class

WkhtmltopdfConfig
Defines wkhtmltopdf form configuration.

Namespace

Drupal\wkhtmltopdf\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('wkhtmltopdf.settings');
  $form['wkhtmltopdf_bin'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Path to binary'),
    '#description' => $this
      ->t('Path to wkhtmltopdf binary'),
    '#default_value' => $config
      ->get('wkhtmltopdf_bin'),
  ];
  $form['wkhtmltopdf_zoom'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Zoom'),
    '#description' => $this
      ->t('Zoom page'),
    '#default_value' => $config
      ->get('wkhtmltopdf_zoom'),
    '#step' => '0.1',
  ];
  $form['wkhtmltopdf_download'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Force download'),
    '#description' => $this
      ->t('Force link download instead redirect'),
    '#default_value' => $config
      ->get('wkhtmltopdf_download'),
  ];
  return parent::buildForm($form, $form_state);
}