public function WkhtmltopdfConfig::buildForm in wkhtmltopdf 2.0.x
Same name and namespace in other branches
- 8 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\FormCode
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_printmedia'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Use --print-media-type command line argument'),
'#description' => $this
->t('Renders the url using the css print media instead of screen'),
'#default_value' => $config
->get('wkhtmltopdf_printmedia'),
];
$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);
}