You are here

abstract class WebformEntityPrintWebformDeriverBase in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_entity_print/src/Plugin/Derivative/WebformEntityPrintWebformDeriverBase.php \Drupal\webform_entity_print\Plugin\Derivative\WebformEntityPrintWebformDeriverBase

Provides base deriver for webform entity print plugins.

Hierarchy

Expanded class hierarchy of WebformEntityPrintWebformDeriverBase

1 file declares its use of WebformEntityPrintWebformDeriverBase
WebformEntityPrintAttachmentDeriver.php in modules/webform_entity_print_attachment/src/Plugin/Derivative/WebformEntityPrintAttachmentDeriver.php

File

modules/webform_entity_print/src/Plugin/Derivative/WebformEntityPrintWebformDeriverBase.php, line 13

Namespace

Drupal\webform_entity_print\Plugin\Derivative
View source
abstract class WebformEntityPrintWebformDeriverBase extends DeriverBase implements ContainerDeriverInterface {
  use StringTranslationTrait;

  /**
   * The entity print export type manager.
   *
   * @var \Drupal\entity_print\Plugin\ExportTypeManagerInterface
   */
  protected $exportTypeManager;

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    $instance = new static();
    $instance->exportTypeManager = $container
      ->get('plugin.manager.entity_print.export_type');
    return $instance;
  }

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    return [];
  }

  /**
   * Get export type definitions.
   *
   * @return array
   *   An array of export type definitions.
   */
  protected function getDefinitions() {
    $definitions = $this->exportTypeManager
      ->getDefinitions();

    // Remove unsupported export types.
    // Issue #2733781: Add Export to Word Support.
    // @see https://www.drupal.org/project/entity_print/issues/2733781
    unset($definitions['word_docx']);

    // Issue #2735559: Add Export to ePub.
    // @see https://www.drupal.org/project/entity_print/issues/2735559
    unset($definitions['epub']);
    return $definitions;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
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.
WebformEntityPrintWebformDeriverBase::$exportTypeManager protected property The entity print export type manager.
WebformEntityPrintWebformDeriverBase::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
WebformEntityPrintWebformDeriverBase::getDefinitions protected function Get export type definitions.
WebformEntityPrintWebformDeriverBase::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions 2