public function LinksConfigurationForm::buildForm in Printer and PDF versions for Drupal 8+ 8
Same name and namespace in other branches
- 2.x src/Form/LinksConfigurationForm.php \Drupal\printable\Form\LinksConfigurationForm::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/ LinksConfigurationForm.php, line 68
Class
- LinksConfigurationForm
- Provides shared configuration form for all printable formats.
Namespace
Drupal\printable\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $printable_format = NULL) {
$form['settings']['print_print_link_pos'] = [
'#type' => 'checkboxes',
'#title' => 'Link location',
'#default_value' => [],
'#options' => [
'node' => $this
->t('Links area'),
'comment' => $this
->t('Comment area'),
'user' => $this
->t('User area'),
],
'#description' => $this
->t('Choose the location of the link(s) to the printer-friendly version pages. The Links area is usually below the node content, whereas the Comment area is placed near the comments. The user area is near the user name. Select the options for which you want to enable the link. If you select any option then it means that you have enabled printable support for that entity in the configuration tab.'),
];
foreach ($this
->config('printable.settings')
->get('printable_print_link_locations') as $link_location) {
$form['settings']['print_print_link_pos']['#default_value'][] = $link_location;
}
$form['settings']['submit'] = [
'#type' => 'submit',
'#value' => 'Submit',
];
return $form;
}