class PrintFormat in Printer and PDF versions for Drupal 8+ 8
Same name and namespace in other branches
- 2.x src/Plugin/PrintableFormat/PrintFormat.php \Drupal\printable\Plugin\PrintableFormat\PrintFormat
Provides a plugin to display a printable version of a page.
Plugin annotation
@PrintableFormat(
id = "print",
module = "printable",
title = @Translation("Print"),
description = @Translation("Printable version of page.")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\printable\Plugin\PrintableFormatBase implements ContainerFactoryPluginInterface, PrintableFormatInterface
- class \Drupal\printable\Plugin\PrintableFormat\PrintFormat
- class \Drupal\printable\Plugin\PrintableFormatBase implements ContainerFactoryPluginInterface, PrintableFormatInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of PrintFormat
1 file declares its use of PrintFormat
- PrintFormatTest.php in tests/
src/ Unit/ Plugin/ PrintableFormat/ PrintFormatTest.php
File
- src/
Plugin/ PrintableFormat/ PrintFormat.php, line 18
Namespace
Drupal\printable\Plugin\PrintableFormatView source
class PrintFormat extends PrintableFormatBase {
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'show_print_dialogue' => TRUE,
];
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this
->setConfiguration([
'show_print_dialogue' => $form_state
->getValue('show_print_dialogue'),
]);
$this
->blockSubmit($form, $form_state);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PrintableFormatBase:: |
protected | property | The config factory service. | |
PrintableFormatBase:: |
protected | property | A render array of the content to be output by the printable format. | |
PrintableFormatBase:: |
protected | property | A string containing the list of links present in the page. | |
PrintableFormatBase:: |
protected | property | Printable link extractor. | |
PrintableFormatBase:: |
protected | property | Printable CSS include manager. | |
PrintableFormatBase:: |
protected | function | Build a render array of the content, wrapped in the printable theme. | |
PrintableFormatBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
1 |
PrintableFormatBase:: |
protected | function | Extracts the links present in HTML string. | |
PrintableFormatBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurablePluginInterface:: |
|
PrintableFormatBase:: |
public | function |
Returns the administrative description for this format plugin. Overrides PrintableFormatInterface:: |
|
PrintableFormatBase:: |
public | function |
Returns the administrative label for this format plugin. Overrides PrintableFormatInterface:: |
|
PrintableFormatBase:: |
protected | function | Get the HTML output of the whole page and pass to the response object. | |
PrintableFormatBase:: |
public | function |
Returns the response object for this format plugin. Overrides PrintableFormatInterface:: |
1 |
PrintableFormatBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurablePluginInterface:: |
|
PrintableFormatBase:: |
public | function |
Set the content for the printable response. Overrides PrintableFormatInterface:: |
|
PrintableFormatBase:: |
public | function |
Overrides PluginBase:: |
1 |
PrintFormat:: |
public | function |
Form constructor. Overrides PluginFormInterface:: |
|
PrintFormat:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
|
PrintFormat:: |
public | function |
Gets default configuration for this plugin. Overrides PrintableFormatBase:: |
|
PrintFormat:: |
public | function |
Form submission handler. Overrides PluginFormInterface:: |
|
PrintFormat:: |
public | function |
Form validation handler. Overrides PrintableFormatBase:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |