You are here

public function DynamicLocalTasks::getDerivativeDefinitions in Lingotek Translation 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/DynamicLocalTasks.php, line 19
Contains \Drupal\example\Plugin\Derivative\DynamicLocalTasks.

Class

DynamicLocalTasks
Defines dynamic local tasks.

Namespace

Drupal\lingotek\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $lingotek_config = \Drupal::service('lingotek.configuration');
  $config = \Drupal::configFactory()
    ->get('lingotek.settings');
  $show_import_tab = $config
    ->get('preference.enable_content_cloud');
  if ($show_import_tab) {
    $this->derivatives['lingotek.import'] = $base_plugin_definition;
    $this->derivatives['lingotek.import']['title'] = 'Import (Beta)';
    $this->derivatives['lingotek.import']['route_name'] = 'lingotek.import';
    $this->derivatives['lingotek.import']['base_route'] = 'lingotek.dashboard';
  }
  return $this->derivatives;
}