You are here

class DynamicLocalTasks in String Overrides 8

Defines dynamic local tasks (menu tabs).

Hierarchy

Expanded class hierarchy of DynamicLocalTasks

1 string reference to 'DynamicLocalTasks'
stringoverrides.links.task.yml in ./stringoverrides.links.task.yml
stringoverrides.links.task.yml

File

src/Plugin/Derivative/DynamicLocalTasks.php, line 10

Namespace

Drupal\stringoverrides\Plugin\Derivative
View source
class DynamicLocalTasks extends DeriverBase {

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $languages = \Drupal::languageManager()
      ->getLanguages();
    foreach ($languages as $language_code => $language) {
      $this->derivatives['stringoverrides.translations_form.' . $language_code] = [
        'title' => $language
          ->getName(),
        'base_route' => 'stringoverrides.translations_form',
        'route_name' => 'stringoverrides.translations_form',
        'route_parameters' => [
          'language' => $language_code,
        ],
        'weight' => 100,
      ] + $base_plugin_definition;
    }
    return parent::getDerivativeDefinitions($base_plugin_definition);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
DynamicLocalTasks::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions