You are here

public function FormatConfigurationFormPrint::buildForm in Printer and PDF versions for Drupal 8+ 8

Same name and namespace in other branches
  1. 2.x src/Form/FormatConfigurationFormPrint.php \Drupal\printable\Form\FormatConfigurationFormPrint::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

src/Form/FormatConfigurationFormPrint.php, line 63

Class

FormatConfigurationFormPrint
Provides shared configuration form for all printable formats.

Namespace

Drupal\printable\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $printable_format = NULL) {
  $form['settings']['print_html_sendtoprinter'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Send to printer'),
    '#default_value' => $this
      ->config('printable.settings')
      ->get('send_to_printer'),
    '#description' => $this
      ->t("Automatically calls the browser's print function when the printer-friendly version is displayed."),
  ];
  $form['settings']['print_html_windowclose'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Close window after sending to printer'),
    '#default_value' => $this
      ->config('printable.settings')
      ->get('close_window'),
    '#description' => $this
      ->t("When the above options are enabled, this option will close the window after its contents are printed."),
  ];
  $form['settings']['print_html_display_sys_urllist'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Printer-friendly URLs list in system pages'),
    '#default_value' => $this
      ->config('printable.settings')
      ->get('list_attribute'),
    '#description' => $this
      ->t('Enabling this option will display a list of printer-friendly destination URLs at the bottom of the page.'),
  ];
  $form['settings']['submit'] = [
    '#type' => 'submit',
    '#value' => 'Submit',
  ];
  return $form;
}