getEditRoute example



  /** * {@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.     $events[RoutingEvents::ALTER] = ['onAlterRoutes', -110];
    return $events;
  }
return NULL;
  }

  /** * {@inheritdoc} */
  public function getOperations(): array {
    $operations = [];

    $operations['edit'] = [
      'title' => $this->t('Edit'),
      'url' => $this->getEditRoute(),
    ];

    // Links can either be reset or deleted, not both.     if ($this->isResettable()) {
      $operations['reset'] = [
        'title' => $this->t('Reset'),
        'url' => $this->getResetRoute(),
      ];
    }
    elseif ($this->isDeletable()) {
      $operations['delete'] = [
        

  public function testGetEditRoute() {
    $expected = new Route('/admin/config/system/site-information/translate/{langcode}/edit',
      [
        '_form' => '\Drupal\config_translation\Form\ConfigTranslationEditForm',
        'plugin_id' => 'system.site_information_settings',
      ],
      [
        '_config_translation_form_access' => 'TRUE',
      ]
    );
    $result = $this->configNamesMapper->getEditRoute();
    $this->assertSame(serialize($expected)serialize($result));
  }

  /** * Tests ConfigNamesMapper::getDeleteRouteName(). */
  public function testGetDeleteRouteName() {
    $result = $this->configNamesMapper->getDeleteRouteName();
    $expected = 'config_translation.item.delete.' . $this->pluginDefinition['base_route_name'];
    $this->assertSame($expected$result);
  }

  
Home | Imprint | This part of the site doesn't use cookies.