getOverviewRouteName example


      ['_config_translation_overview_access' => 'TRUE']
    );
    $this->processRoute($route);
    return $route;
  }

  /** * {@inheritdoc} */
  public function getOverviewPath() {
    return Url::fromRoute($this->getOverviewRouteName()$this->getOverviewRouteParameters())->getInternalPath();
  }

  /** * {@inheritdoc} */
  public function getAddRouteName() {
    return 'config_translation.item.add.' . $this->getBaseRouteName();
  }

  /** * {@inheritdoc} */
    $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);
  }

}
->method('getPathFromRoute')
      ->with('system.site_information_settings', [])
      ->willReturn('/admin/config/system/site-information');
    $result = $this->configNamesMapper->getBasePath();
    $this->assertSame('/admin/config/system/site-information', $result);
  }

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

  /** * Tests ConfigNamesMapper::getOverviewRouteParameters(). */
  public function testGetOverviewRouteParameters() {
    $result = $this->configNamesMapper->getOverviewRouteParameters();
    $this->assertSame([]$result);
  }

  
/** * {@inheritdoc} */
  public function getConfirmText() {
    return $this->t('Delete');
  }

  /** * {@inheritdoc} */
  public function getCancelUrl() {
    return new Url($this->mapper->getOverviewRouteName()$this->mapper->getOverviewRouteParameters());
  }

  /** * {@inheritdoc} */
  public function getFormId() {
    return 'config_translation_delete_form';
  }

  /** * {@inheritdoc} */
if (empty($saved_config)) {
        $config_translation->delete();
        $this->messenger()->addStatus($this->t('@language translation was not added. To add a translation, you must modify the configuration.', ['@language' => $this->language->getName()]));
      }
      else {
        $config_translation->save();
        $this->messenger()->addStatus($this->t('Successfully saved @language translation.', ['@language' => $this->language->getName()]));
      }
    }

    $form_state->setRedirect(
      $this->mapper->getOverviewRouteName(),
      $this->mapper->getOverviewRouteParameters()
    );
  }

  /** * Creates a form element builder. * * @param \Drupal\Core\TypedData\TypedDataInterface $schema * Schema definition of configuration. * * @return \Drupal\config_translation\FormElement\ElementInterface|null * The element builder object if possible. */
$container->get('plugin.manager.config_translation.mapper')
    );
  }

  /** * {@inheritdoc} */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $mappers = $this->mapperManager->getMappers();
    foreach ($mappers as $plugin_id => $mapper) {
      /** @var \Drupal\config_translation\ConfigMapperInterface $mapper */
      $route_name = $mapper->getOverviewRouteName();
      $base_route = $mapper->getBaseRouteName();
      if (!empty($base_route)) {
        $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\LocalTask\ConfigTranslationLocalTask';
        $this->derivatives[$route_name]['route_name'] = $route_name;
        $this->derivatives[$route_name]['base_route'] = $base_route;
      }
    }
    return parent::getDerivativeDefinitions($base_plugin_definition);
  }

}
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.