You are here

class PrintFormat in Printer and PDF versions for Drupal 8+ 8

Same name and namespace in other branches
  1. 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

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\PrintableFormat
View 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

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PrintableFormatBase::$configFactory protected property The config factory service.
PrintableFormatBase::$content protected property A render array of the content to be output by the printable format.
PrintableFormatBase::$footerContent protected property A string containing the list of links present in the page.
PrintableFormatBase::$linkExtractor protected property Printable link extractor.
PrintableFormatBase::$printableCssInclude protected property Printable CSS include manager.
PrintableFormatBase::buildContent protected function Build a render array of the content, wrapped in the printable theme.
PrintableFormatBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 1
PrintableFormatBase::extractLinks protected function Extracts the links present in HTML string.
PrintableFormatBase::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurablePluginInterface::getConfiguration
PrintableFormatBase::getDescription public function Returns the administrative description for this format plugin. Overrides PrintableFormatInterface::getDescription
PrintableFormatBase::getLabel public function Returns the administrative label for this format plugin. Overrides PrintableFormatInterface::getLabel
PrintableFormatBase::getOutput protected function Get the HTML output of the whole page and pass to the response object.
PrintableFormatBase::getResponse public function Returns the response object for this format plugin. Overrides PrintableFormatInterface::getResponse 1
PrintableFormatBase::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurablePluginInterface::setConfiguration
PrintableFormatBase::setContent public function Set the content for the printable response. Overrides PrintableFormatInterface::setContent
PrintableFormatBase::__construct public function Overrides PluginBase::__construct 1
PrintFormat::buildConfigurationForm public function Form constructor. Overrides PluginFormInterface::buildConfigurationForm
PrintFormat::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides DependentPluginInterface::calculateDependencies
PrintFormat::defaultConfiguration public function Gets default configuration for this plugin. Overrides PrintableFormatBase::defaultConfiguration
PrintFormat::submitConfigurationForm public function Form submission handler. Overrides PluginFormInterface::submitConfigurationForm
PrintFormat::validateConfigurationForm public function Form validation handler. Overrides PrintableFormatBase::validateConfigurationForm
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.