You are here

public function PrintableLinksBlock::getDerivativeDefinitions in Printer and PDF versions for Drupal 8+ 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Derivative/PrintableLinksBlock.php \Drupal\printable\Plugin\Derivative\PrintableLinksBlock::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/Derivative/PrintableLinksBlock.php, line 52

Class

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

Namespace

Drupal\printable\Plugin\Derivative

Code

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;
}