You are here

public function MenuLinkConfig::getTranslateRoute in Config menu link 8

Returns route information for a route to translate the menu link.

Return value

\Drupal\Core\Url|null A Url object, or NULL if there is no route (e.g. when the link is not translatable).

Overrides MenuLinkContent::getTranslateRoute

File

src/Plugin/Menu/MenuLinkConfig.php, line 138
Contains \Drupal\menu_link_config\Plugin\Menu\MenuLinkConfig.

Class

MenuLinkConfig
Provides a menu link plugin based upon storage in config.

Namespace

Drupal\menu_link_config\Plugin\Menu

Code

public function getTranslateRoute() {

  // @todo There should be some way for Config Translation module to alter
  //   this information in on its own.
  if ($this->mapperManager) {
    $entity_type = 'menu_link_config';

    /** @var \Drupal\menu_link_config\MenuLinkConfigMapper $mapper */
    $mapper = $this->mapperManager
      ->createInstance($entity_type);
    $mapper
      ->setEntity($this
      ->getEntity());
    return array(
      'route_name' => $mapper
        ->getOverviewRouteName(),
      'route_parameters' => $mapper
        ->getOverviewRouteParameters(),
    );
  }
}