PrintFormat.php in Printer and PDF versions for Drupal 8+ 8
File
src/Plugin/PrintableFormat/PrintFormat.php
View source
<?php
namespace Drupal\printable\Plugin\PrintableFormat;
use Drupal\printable\Plugin\PrintableFormatBase;
use Drupal\Core\Form\FormStateInterface;
class PrintFormat extends PrintableFormatBase {
public function defaultConfiguration() {
return [
'show_print_dialogue' => TRUE,
];
}
public function calculateDependencies() {
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$config = $this
->getConfiguration();
$form['show_print_dialogue'] = [
'#type' => 'checkbox',
'#title' => 'Show print dialogue',
'#default_value' => $config['show_print_dialogue'],
];
return $form;
}
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this
->setConfiguration([
'show_print_dialogue' => $form_state
->getValue('show_print_dialogue'),
]);
$this
->blockSubmit($form, $form_state);
}
}
Classes
Name |
Description |
PrintFormat |
Provides a plugin to display a printable version of a page. |