class PrintableLinksBlock in Printer and PDF versions for Drupal 8+ 8
Same name in this branch
- 8 src/Plugin/Derivative/PrintableLinksBlock.php \Drupal\printable\Plugin\Derivative\PrintableLinksBlock
- 8 src/Plugin/Block/PrintableLinksBlock.php \Drupal\printable\Plugin\Block\PrintableLinksBlock
Same name and namespace in other branches
- 2.x src/Plugin/Derivative/PrintableLinksBlock.php \Drupal\printable\Plugin\Derivative\PrintableLinksBlock
Local tasks plugin derivative to provide a tab for each printable format.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\printable\Plugin\Derivative\PrintableLinksBlock implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of PrintableLinksBlock
1 file declares its use of PrintableLinksBlock
- PrintableLinksBlockTest.php in tests/
src/ Unit/ Plugin/ Derivative/ PrintableLinksBlockTest.php
File
- src/
Plugin/ Derivative/ PrintableLinksBlock.php, line 15
Namespace
Drupal\printable\Plugin\DerivativeView source
class PrintableLinksBlock extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The printable entity manager.
*
* @var \Drupal\printable\PrintableEntityManagerInterface
*/
protected $printableEntityManager;
/**
* Construct a new printable format links block.
*
* @param \Drupal\printable\PrintableEntityManagerInterface $printable_entity_manager
* The printable entity manager.
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager
* The translation manager.
*/
public function __construct(PrintableEntityManagerInterface $printable_entity_manager, TranslationInterface $translation_manager) {
$this->printableEntityManager = $printable_entity_manager;
$this->stringTranslation = $translation_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('printable.entity_manager'), $container
->get('string_translation'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->printableEntityManager
->getPrintableEntities() as $entity_type => $entity_definition) {
$this->derivatives[$entity_type] = $base_plugin_definition;
$this->derivatives[$entity_type]['admin_label'] = $this
->t('@name (@entity_name)', [
'@name' => $this->derivatives[$entity_type]['admin_label'],
'@entity_name' => $entity_definition
->getLabel(),
]);
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
PrintableLinksBlock:: |
protected | property | The printable entity manager. | |
PrintableLinksBlock:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
PrintableLinksBlock:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
PrintableLinksBlock:: |
public | function | Construct a new printable format links block. | |
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. |