diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index 932218b..86a4829 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -8,6 +8,7 @@ use Drupal\config_translation\Plugin\Derivative\ConfigTranslationLocalTasks; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\field\FieldConfigInterface; use Symfony\Component\Routing\Exception\RouteNotFoundException; /** @@ -83,7 +84,7 @@ function config_translation_entity_type_alter(array &$entity_types) { elseif ($entity_type_id == 'field_config') { $class = 'Drupal\config_translation\Controller\ConfigTranslationFieldListBuilder'; // Will be filled in dynamically, see \Drupal\field\Entity\FieldConfig::linkTemplates(). - $entity_type->setLinkTemplate("config-translation-overview.field_ui-field-$entity_type_id-edit-form", "entity.config_translation_overview.field_ui_field_{$entity_type_id}_edit_form"); + $entity_type->setLinkTemplate('config-translation-overview', 'entity.' . $entity_type_id . '.config_translation_overview'); } else { $class = 'Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder'; @@ -160,10 +161,17 @@ function config_translation_entity_operation(EntityInterface $entity) { if ($entity_type->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface') && $entity->hasLinkTemplate('config-translation-overview') && \Drupal::currentUser()->hasPermission('translate configuration')) { + + $link_template = 'config-translation-overview'; + // @todo Special case field UI. + if ($entity instanceof FieldConfigInterface) { + $link_template = "config-translation-overview.{$entity->getTargetEntityTypeId()}"; + } + $operations['translate'] = array( 'title' => t('Translate'), 'weight' => 50, - ) + $entity->urlInfo('config-translation-overview')->toArray(); + ) + $entity->urlInfo($link_template)->toArray(); } return $operations; diff --git a/core/modules/config_translation/src/ConfigFieldMapper.php b/core/modules/config_translation/src/ConfigFieldMapper.php index 242e084..140cec8 100644 --- a/core/modules/config_translation/src/ConfigFieldMapper.php +++ b/core/modules/config_translation/src/ConfigFieldMapper.php @@ -37,6 +37,13 @@ public function getBaseRouteParameters() { /** * {@inheritdoc} */ + public function getOverviewRouteName() { + return "entity.field_config.config_translation_overview.{$this->pluginDefinition['base_entity_type']}"; + } + + /** + * {@inheritdoc} + */ public function getTypeLabel() { $base_entity_info = $this->entityManager->getDefinition($this->pluginDefinition['base_entity_type']); return $this->t('@label fields', array('@label' => $base_entity_info->getLabel())); diff --git a/core/modules/field/src/Entity/FieldConfig.php b/core/modules/field/src/Entity/FieldConfig.php index a6fe1ee..e94c937 100644 --- a/core/modules/field/src/Entity/FieldConfig.php +++ b/core/modules/field/src/Entity/FieldConfig.php @@ -258,12 +258,12 @@ public static function postDelete(EntityStorageInterface $storage, array $fields protected function linkTemplates() { $link_templates = parent::linkTemplates(); if (\Drupal::moduleHandler()->moduleExists('field_ui')) { - $link_templates["field_ui.field-{$this->entity_type}-edit-form"] = 'entity.field_config.' . $this->entity_type . '_field_edit_form'; - $link_templates["field_ui.storage-{$this->entity_type}-edit-form"] = 'entity.field_config.' . $this->entity_type . '_storage_edit_form'; - $link_templates["field_ui.field-{$this->entity_type}-delete-form"] = 'entity.field_config.' . $this->entity_type . '_field_delete_form'; + $link_templates["{$this->entity_type}-field-edit-form"] = 'entity.field_config.' . $this->entity_type . '_field_edit_form'; + $link_templates["{$this->entity_type}-storage-edit-form"] = 'entity.field_config.' . $this->entity_type . '_storage_edit_form'; + $link_templates["{$this->entity_type}-field-delete-form"] = 'entity.field_config.' . $this->entity_type . '_field_delete_form'; - if (isset($link_templates['drupal:config-translation-overview'])) { - $link_templates["config-translation-overview.field_ui-field-{$this->entity_type}-edit-form"] = "entity.config_translation_overview.field_ui_field_{$this->entity_type}_edit_form"; + if (isset($link_templates['config-translation-overview'])) { + $link_templates["config-translation-overview.{$this->entity_type}"] = "entity.field_config.config_translation_overview.{$this->entity_type}"; } } return $link_templates; diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index cf3efc3..eab57d1 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -44,7 +44,7 @@ function field_ui_help($route_name, RouteMatchInterface $route_match) { $output .= '
' . t('Fields on taxonomy terms') . '
'; $output .= '
' . t('Fields on taxonomy terms are defined at the taxonomy vocabulary level, on the Manage fields tab of the vocabulary edit page (which you can reach from the Taxonomy page). When you define a field for a vocabulary, each term in that vocabulary will have that field added to it. For example, you could define an image field for a vocabulary to store an icon with each term.', array('@taxonomy' => \Drupal::url('taxonomy.vocabulary_list'))) . '
'; $output .= '
' . t('Fields on user accounts') . '
'; - $output .= '
' . t('Fields on user accounts are defined on a site-wide basis on the Manage fields tab of the Account settings page. When you define a field for user accounts, each user account will have that field added to it. For example, you could add a long text field to allow users to include a biography.', array('@fields' => \Drupal::url('field_ui.overview_user'), '@accounts' => \Drupal::url('entity.user.admin_form'))) . '
'; + $output .= '
' . t('Fields on user accounts are defined on a site-wide basis on the Manage fields tab of the Account settings page. When you define a field for user accounts, each user account will have that field added to it. For example, you could add a long text field to allow users to include a biography.', array('@fields' => \Drupal::url('entity.user.field_ui_fields'), '@accounts' => \Drupal::url('entity.user.admin_form'))) . '
'; $output .= '
' . t('Fields on comments') . '
'; $output .= '
' . t('Fields on comments are defined at the content-type level, on the Comment fields tab of the content type edit page (which you can reach from the Content types page). When you add a field for comments, each comment on a content item of that type will have that field added to it. For example, you could add a website field to the comments on forum posts, to allow forum commenters to add a link to their website.', array('@types' => \Drupal::url('node.overview_types'))) . '
'; $output .= ''; diff --git a/core/modules/field_ui/src/FieldConfigListBuilder.php b/core/modules/field_ui/src/FieldConfigListBuilder.php index 60e0048..8b02c0b 100644 --- a/core/modules/field_ui/src/FieldConfigListBuilder.php +++ b/core/modules/field_ui/src/FieldConfigListBuilder.php @@ -62,17 +62,17 @@ public function getDefaultOperations(EntityInterface $entity) { /** @var \Drupal\field\FieldConfigInterface $entity */ $operations = parent::getDefaultOperations($entity); - if ($entity->access('update') && $entity->hasLinkTemplate("field_ui.field-{$entity->entity_type}-edit-form")) { + if ($entity->access('update') && $entity->hasLinkTemplate("{$entity->entity_type}-field-edit-form")) { $operations['edit'] = array( 'title' => $this->t('Edit'), 'weight' => 10, - ) + $entity->urlInfo("field_ui.field-{$entity->entity_type}-edit-form")->toArray(); + ) + $entity->urlInfo("{$entity->entity_type}-field-edit-form")->toArray(); } - if ($entity->access('delete') && $entity->hasLinkTemplate("field_ui.field-{$entity->entity_type}-delete-form")) { + if ($entity->access('delete') && $entity->hasLinkTemplate("{$entity->entity_type}-field-delete-form")) { $operations['delete'] = array( 'title' => $this->t('Delete'), 'weight' => 100, - ) + $entity->urlInfo("field_ui.field-{$entity->entity_type}-delete-form")->toArray(); + ) + $entity->urlInfo("{$entity->entity_type}-field-delete-form")->toArray(); } $bundle = $this->entityManager->getDefinition($entity->entity_type)->getBundleEntityType(); @@ -80,7 +80,7 @@ public function getDefaultOperations(EntityInterface $entity) { 'title' => $this->t('Field settings'), 'weight' => 20, 'attributes' => array('title' => $this->t('Edit field settings.')), - ) + $entity->urlInfo("field_ui.storage-{$entity->entity_type}-edit-form")->toArray(); + ) + $entity->urlInfo("{$entity->entity_type}-storage-edit-form")->toArray(); $operations['edit']['attributes']['title'] = $this->t('Edit instance settings.'); $operations['delete']['attributes']['title'] = $this->t('Delete instance.'); diff --git a/core/modules/forum/forum.routing.yml b/core/modules/forum/forum.routing.yml index ac9d35d..6302fa6 100644 --- a/core/modules/forum/forum.routing.yml +++ b/core/modules/forum/forum.routing.yml @@ -46,7 +46,7 @@ forum.add_forum: requirements: _permission: 'administer forums' -forum.edit_container: +entity.taxonomy_term.forum_edit_container: path: '/admin/structure/forum/edit/container/{taxonomy_term}' defaults: _entity_form: 'taxonomy_term.container' diff --git a/core/modules/forum/src/Form/ForumForm.php b/core/modules/forum/src/Form/ForumForm.php index 6a8131a..20deec3 100644 --- a/core/modules/forum/src/Form/ForumForm.php +++ b/core/modules/forum/src/Form/ForumForm.php @@ -80,7 +80,7 @@ public function save(array $form, FormStateInterface $form_state) { $term_storage = $this->entityManager->getStorage('taxonomy_term'); $status = $term_storage->save($term); - $route_name = $this->urlStub == 'container' ? 'forum.edit_container' : 'forum.edit_forum'; + $route_name = $this->urlStub == 'container' ? 'entity.taxonomy_term.forum_edit_container' : 'entity.taxonomy_term.forum_edit_form'; $route_parameters = ['taxonomy_term' => $term->id()]; $link = $this->l($this->t('Edit'), new Url($route_name, $route_parameters)); switch ($status) { diff --git a/core/modules/forum/src/Form/Overview.php b/core/modules/forum/src/Form/Overview.php index a8dbdf3..2b1032e 100644 --- a/core/modules/forum/src/Form/Overview.php +++ b/core/modules/forum/src/Form/Overview.php @@ -69,7 +69,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { unset($form['terms'][$key]['operations']['#links']['delete']); if (!empty($term->forum_container->value)) { $form['terms'][$key]['operations']['#links']['edit']['title'] = $this->t('edit container'); - $form['terms'][$key]['operations']['#links']['edit']['route_name'] = 'forum.edit_container'; + $form['terms'][$key]['operations']['#links']['edit']['route_name'] = 'entity.taxonomy_term.forum_edit_container'; // We don't want the redirect from the link so we can redirect the // delete action. unset($form['terms'][$key]['operations']['#links']['edit']['query']['destination']); diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index e17eb01..2024f47 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -56,6 +56,7 @@ function entity_test_entity_types($filter = NULL) { $types[] = 'entity_test_rev'; } $types[] = 'entity_test_mulrev'; + $types[] = 'entity_test_base_field_display'; return array_combine($types, $types); }