You are here

public function SchemeLocalTask::getDerivativeDefinitions in Taxonomy Access Control Lite 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

src/Plugin/Derivative/SchemeLocalTask.php, line 14

Class

SchemeLocalTask
Provides local tasks for each search page.

Namespace

Drupal\tac_lite\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = [];
  $config = \Drupal::config('tac_lite.settings');
  $schemes = $config
    ->get('tac_lite_schemes');
  for ($i = 1; $i <= $schemes; $i++) {
    $scheme = $config
      ->get('tac_lite_config_scheme_' . $i);
    $title = $scheme['name'] ? $scheme['name'] : 'Scheme ' . $i;
    $this->derivatives[] = [
      'title' => $title,
      'route_name' => 'tac_lite.scheme_' . $i,
      'base_route' => 'tac_lite.administration',
      'weight' => $i,
    ];
  }
  return $this->derivatives;
}