You are here

public function DashboardBlock::getDerivativeDefinitions in Dashboards with Layout Builder 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Derivative/DashboardBlock.php \Drupal\dashboards\Plugin\Derivative\DashboardBlock::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/DashboardBlock.php, line 28

Class

DashboardBlock
Provides block plugin definitions for dashboard blocks.

Namespace

Drupal\dashboards\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $definitions = $this->manager
    ->getDefinitions();
  foreach ($definitions as $id => $definition) {
    $this->derivatives['dashboard:' . $id] = $base_plugin_definition;
    $this->derivatives['dashboard:' . $id]['admin_label'] = $this
      ->t('@display_name', [
      '@display_name' => $definition['label'],
    ]);
    $this->derivatives['dashboard:' . $id]['category'] = $this
      ->t('@category', [
      '@category' => $definition['category'],
    ]);
  }
  return $this->derivatives;
}