You are here

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

Same name and namespace in other branches
  1. 2.x src/Plugin/Derivative/PrintableFormatConfigureTabs.php \Drupal\printable\Plugin\Derivative\PrintableFormatConfigureTabs

Local tasks plugin derivative to provide a tab for each printable format.

Hierarchy

Expanded class hierarchy of PrintableFormatConfigureTabs

1 file declares its use of PrintableFormatConfigureTabs
PrintableFormatConfigureTabsTest.php in tests/src/Unit/Plugin/Derivative/PrintableFormatConfigureTabsTest.php
1 string reference to 'PrintableFormatConfigureTabs'
printable.links.task.yml in ./printable.links.task.yml
printable.links.task.yml

File

src/Plugin/Derivative/PrintableFormatConfigureTabs.php, line 13

Namespace

Drupal\printable\Plugin\Derivative
View source
class PrintableFormatConfigureTabs extends DeriverBase implements ContainerDeriverInterface {

  /**
   * The printable format plugin manager.
   *
   * @var \Drupal\printable\PrintableFormatPluginManager
   */
  protected $printableFormatManager;

  /**
   * Construct a new printable format configuration tab plugin derivative.
   *
   * @param \Drupal\printable\PrintableFormatPluginManager $printable_format_manager
   *   The printable format plugin manager.
   */
  public function __construct(PrintableFormatPluginManager $printable_format_manager) {
    $this->printableFormatManager = $printable_format_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container
      ->get('printable.format_plugin_manager'));
  }

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    foreach ($this->printableFormatManager
      ->getDefinitions() as $key => $definition) {
      $this->derivatives[$key] = $base_plugin_definition;
      $this->derivatives[$key]['title'] = $definition['title'];
      $this->derivatives[$key]['route_name'] = 'printable.format_configure_' . $key;
    }
    return $this->derivatives;
  }

}

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
PrintableFormatConfigureTabs::$printableFormatManager protected property The printable format plugin manager.
PrintableFormatConfigureTabs::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
PrintableFormatConfigureTabs::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
PrintableFormatConfigureTabs::__construct public function Construct a new printable format configuration tab plugin derivative.