You are here

public function SearchApiStatsBlock::getDerivativeDefinitions in Search API Stats 8

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

modules/search_api_stats_block/src/Plugin/Derivative/SearchApiStatsBlock.php, line 42

Class

SearchApiStatsBlock
Provides block plugin definitions for mymodule blocks.

Namespace

Drupal\search_api_stats_block\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {

  /** @var \Drupal\search_api\Entity\Index[] $indexes */
  $indexes = Index::loadMultiple();
  foreach ($indexes as $key => $index) {
    $this->derivatives[$key] = $base_plugin_definition;
    $this->derivatives[$key]['admin_label'] = t('Search API stats block: :label', [
      ':label' => $index
        ->label(),
    ]);
    $this->derivatives[$key]['config_dependencies']['config'] = [];
  }
  return $this->derivatives;
}