function ConfigTranslationContextualLinks::getDerivativeDefinitions

Same name in other branches
  1. 9 core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationContextualLinks.php \Drupal\config_translation\Plugin\Derivative\ConfigTranslationContextualLinks::getDerivativeDefinitions()
  2. 8.9.x core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationContextualLinks.php \Drupal\config_translation\Plugin\Derivative\ConfigTranslationContextualLinks::getDerivativeDefinitions()
  3. 10 core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationContextualLinks.php \Drupal\config_translation\Plugin\Derivative\ConfigTranslationContextualLinks::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/config_translation/src/Plugin/Derivative/ConfigTranslationContextualLinks.php, line 44

Class

ConfigTranslationContextualLinks
Provides dynamic contextual links for configuration translation.

Namespace

Drupal\config_translation\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    // Create contextual links for all mappers.
    $mappers = $this->mapperManager
        ->getMappers();
    foreach ($mappers as $plugin_id => $mapper) {
        // @todo Contextual groups do not map to entity types in a predictable
        //   way. See https://www.drupal.org/node/2134841 to make them
        //   predictable.
        $group_name = $mapper->getContextualLinkGroup();
        if (empty($group_name)) {
            continue;
        }
        
        /** @var \Drupal\config_translation\ConfigMapperInterface $mapper */
        $route_name = $mapper->getOverviewRouteName();
        $this->derivatives[$route_name] = $base_plugin_definition;
        $this->derivatives[$route_name]['config_translation_plugin_id'] = $plugin_id;
        $this->derivatives[$route_name]['class'] = '\\Drupal\\config_translation\\Plugin\\Menu\\ContextualLink\\ConfigTranslationContextualLink';
        $this->derivatives[$route_name]['route_name'] = $route_name;
        $this->derivatives[$route_name]['group'] = $group_name;
    }
    return parent::getDerivativeDefinitions($base_plugin_definition);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.