getOverviewRoute example


  public function testGetOverviewRoute() {
    $expected = new Route('/admin/config/system/site-information/translate',
      [
        '_controller' => '\Drupal\config_translation\Controller\ConfigTranslationController::itemPage',
        'plugin_id' => 'system.site_information_settings',
      ],
      [
        '_config_translation_overview_access' => 'TRUE',
      ]
    );
    $result = $this->configNamesMapper->getOverviewRoute();
    $this->assertSame(serialize($expected)serialize($result));
  }

  /** * Tests ConfigNamesMapper::getOverviewPath(). */
  public function testGetOverviewPath() {
    $this->urlGenerator->expects($this->once())
      ->method('getPathFromRoute')
      ->with('config_translation.item.overview.system.site_information_settings', [])
      ->willReturn('/admin/config/system/site-information/translate');

    
public function __construct(ConfigMapperManagerInterface $mapper_manager) {
    $this->mapperManager = $mapper_manager;
  }

  /** * {@inheritdoc} */
  protected function alterRoutes(RouteCollection $collection) {
    $mappers = $this->mapperManager->getMappers($collection);

    foreach ($mappers as $mapper) {
      $collection->add($mapper->getOverviewRouteName()$mapper->getOverviewRoute());
      $collection->add($mapper->getAddRouteName()$mapper->getAddRoute());
      $collection->add($mapper->getEditRouteName()$mapper->getEditRoute());
      $collection->add($mapper->getDeleteRouteName()$mapper->getDeleteRoute());
    }
  }

  /** * {@inheritdoc} */
  public static function getSubscribedEvents(): array {
    // Come after field_ui.
Home | Imprint | This part of the site doesn't use cookies.