diff --git a/core/modules/config_translation/config_translation.api.php b/core/modules/config_translation/config_translation.api.php index e44c168..f631655 100644 --- a/core/modules/config_translation/config_translation.api.php +++ b/core/modules/config_translation/config_translation.api.php @@ -36,13 +36,13 @@ function hook_config_translation_info(&$info) { $route_provider = \Drupal::service('router.route_provider'); // If field UI is not enabled, the base routes of the type - // "field_ui.field_edit_$entity_type" are not defined. + // "entity.field_config.{$entity_type}_field_edit_form" are not defined. if (\Drupal::moduleHandler()->moduleExists('field_ui')) { // Add fields entity mappers to all fieldable entity types defined. foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { $base_route = NULL; try { - $base_route = $route_provider->getRouteByName('field_ui.field_edit_' . $entity_type_id); + $base_route = $route_provider->getRouteByName('entity.field_config.' . $entity_type_id . '_field_edit_form'); } catch (RouteNotFoundException $e) { // Ignore non-existent routes. @@ -51,7 +51,7 @@ function hook_config_translation_info(&$info) { // Make sure entity type has field UI enabled and has a base route. if ($entity_type->get('field_ui_base_route') && !empty($base_route)) { $info[$entity_type_id . '_fields'] = array( - 'base_route_name' => 'field_ui.field_edit_' . $entity_type_id, + 'base_route_name' => 'entity.field_config.' . $entity_type_id . '_field_edit_form', 'entity_type' => 'field_config', 'title' => t('!label field'), 'class' => '\Drupal\config_translation\ConfigFieldMapper', diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index 553d07b..2418d4a 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -105,17 +105,17 @@ function config_translation_config_translation_info(&$info) { $route_provider = \Drupal::service('router.route_provider'); // If field UI is not enabled, the base routes of the type - // "field_ui.field_edit_$entity_type" are not defined. + // "entity.field_config.{$entity_type}_field_edit_form" are not defined. if (\Drupal::moduleHandler()->moduleExists('field_ui')) { // Add fields entity mappers to all fieldable entity types defined. foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { $base_route = NULL; try { - $base_route = $route_provider->getRouteByName('field_ui.field_edit_' . $entity_type_id); + $base_route = $route_provider->getRouteByName('entity.field_config.' . $entity_type_id . '_field_edit_form'); } catch (RouteNotFoundException $e) { if ($collection = \Drupal::service('router.builder')->getCollectionDuringRebuild()) { - $base_route = $collection->get('field_ui.field_edit_' . $entity_type_id); + $base_route = $collection->get('entity.field_config.' . $entity_type_id . '_field_edit_form'); } // Ignore non-existent routes. } @@ -123,7 +123,7 @@ function config_translation_config_translation_info(&$info) { // Make sure entity type has field UI enabled and has a base route. if ($entity_type->get('field_ui_base_route') && !empty($base_route)) { $info[$entity_type_id . '_fields'] = array( - 'base_route_name' => "entity.field_config.field_ui.field_{$entity_type_id}_edit_form", + 'base_route_name' => "entity.field_config.{$entity_type_id}_field_edit_form", 'entity_type' => 'field_config', 'title' => '!label field', 'class' => '\Drupal\config_translation\ConfigFieldMapper', diff --git a/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php b/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php index c484f3c..9acf394 100644 --- a/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php +++ b/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationContextualLinks.php @@ -56,7 +56,6 @@ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives[$entity_type_id]['route_name'] = "entity.$entity_type_id.content_translation_overview"; $this->derivatives[$entity_type_id]['group'] = $entity_type_id; } - debug($this->derivatives); return parent::getDerivativeDefinitions($base_plugin_definition); } diff --git a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php index 8b834eb..7aacd04 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php @@ -131,7 +131,6 @@ public function testContentTranslationContextualLinks() { $response = $this->renderContextualLinks(array('node:node=1:'), 'node/' . $node->id()); $this->assertResponse(200); $json = Json::decode($response); - debug($json); $this->drupalSetContent($json['node:node=1:']); $this->assertLinkByHref($translate_link, 0, 'The contextual link to translate the node is shown.'); diff --git a/core/modules/field/src/Entity/FieldConfig.php b/core/modules/field/src/Entity/FieldConfig.php index a1a98db..a6fe1ee 100644 --- a/core/modules/field/src/Entity/FieldConfig.php +++ b/core/modules/field/src/Entity/FieldConfig.php @@ -258,9 +258,9 @@ 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"] = 'field_ui.field_edit_' . $this->entity_type; - $link_templates["field_ui.storage-{$this->entity_type}-edit-form"] = 'field_ui.storage_edit_' . $this->entity_type; - $link_templates["field_ui.field-{$this->entity_type}-delete-form"] = 'field_ui.field_delete_' . $this->entity_type; + $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'; 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"; diff --git a/core/modules/field_ui/src/FieldOverview.php b/core/modules/field_ui/src/FieldOverview.php index 423ae13..05a58e5 100644 --- a/core/modules/field_ui/src/FieldOverview.php +++ b/core/modules/field_ui/src/FieldOverview.php @@ -135,7 +135,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $entity_t 'type' => array( '#type' => 'link', '#title' => $field_types[$field_storage->getType()]['label'], - '#route_name' => "entity.field_config.field_ui.storage_{$this->entity_type}_edit_form", + '#route_name' => "entity.field_config.{$this->entity_type}_storage_edit_form", '#route_parameters' => $route_parameters, '#options' => array('attributes' => array('title' => $this->t('Edit field settings.'))), ), @@ -410,8 +410,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $this->bundleEntityType => $this->bundle, 'field_config' => $new_field->id(), ); - $destinations[] = array('route_name' => "entity.field_config.field_ui.storage_{$this->entity_type}_edit_form", 'route_parameters' => $route_parameters); - $destinations[] = array('route_name' => "entity.field_config.field_ui.field_{$this->entity_type}_edit_form", 'route_parameters' => $route_parameters); + $destinations[] = array('route_name' => "entity.field_config.{$this->entity_type}_storage_edit_form", 'route_parameters' => $route_parameters); + $destinations[] = array('route_name' => "entity.field_config.{$this->entity_type}_field_edit_form", 'route_parameters' => $route_parameters); // Store new field information for any additional submit handlers. $form_state->set(['fields_added', '_add_new_field'], $values['field_name']); @@ -457,7 +457,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ->save(); $destinations[] = array( - 'route_name' => 'field_ui.field_edit_' . $this->entity_type, + 'route_name' => 'entity.field_config.' . $this->entity_type . '_field_edit_form', 'route_parameters' => array( $this->bundleEntityType => $this->bundle, 'field_config' => $new_field->id(), diff --git a/core/modules/field_ui/src/FieldUI.php b/core/modules/field_ui/src/FieldUI.php index 33003bf..bbb35e2 100644 --- a/core/modules/field_ui/src/FieldUI.php +++ b/core/modules/field_ui/src/FieldUI.php @@ -29,7 +29,7 @@ class FieldUI { public static function getOverviewRouteInfo($entity_type_id, $bundle) { $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); if ($entity_type->get('field_ui_base_route')) { - $bundle_entity_type = $entity_type->getBundleEntityType() != 'bundle'? $entity_type->getBundleEntityType() : $entity_type->id(); + $bundle_entity_type = $entity_type->getBundleEntityType() != 'bundle' ? $entity_type->getBundleEntityType() : $entity_type->id(); return new Url("entity.{$bundle_entity_type}.field_ui_fields", array( $entity_type->getBundleEntityType() => $bundle, )); diff --git a/core/modules/field_ui/src/Form/FieldEditForm.php b/core/modules/field_ui/src/Form/FieldEditForm.php index 9e23ee1..51cf8fe 100644 --- a/core/modules/field_ui/src/Form/FieldEditForm.php +++ b/core/modules/field_ui/src/Form/FieldEditForm.php @@ -222,7 +222,7 @@ public function delete(array &$form, FormStateInterface $form_state) { } $entity_type = $this->entityManager->getDefinition($this->field->entity_type); $form_state->setRedirect( - 'field_ui.delete_' . $this->field->entity_type, + 'entity.field_config.' . $this->field->entity_type . '_field_delete_form', array( $entity_type->getBundleEntityType() => $this->field->bundle, 'field_config' => $this->field->id(), diff --git a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php index 5760086..fa68862 100644 --- a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php +++ b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php @@ -70,7 +70,11 @@ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { if ($entity_type->get('field_ui_base_route')) { - $field_entity_type = $entity_type->getBundleEntityType() != 'bundle' ? $entity_type->getBundleEntityType() : $entity_type_id; + $field_entity_type = $entity_type->getBundleEntityType(); + if ($field_entity_type == 'bundle') { + $field_entity_type = $entity_type_id; + } + $this->derivatives["overview_$field_entity_type"] = array( 'route_name' => "entity.$field_entity_type.field_ui_fields", 'weight' => 1, @@ -96,16 +100,16 @@ public function getDerivativeDefinitions($base_plugin_definition) { // Field edit tab. $this->derivatives["field_edit_$field_entity_type"] = array( - 'route_name' => "field_ui.field_edit_$field_entity_type", + 'route_name' => "entity.field_config.{$field_entity_type}.field_edit_form", 'title' => $this->t('Edit'), - 'base_route' => "field_ui.field_edit_$field_entity_type", + 'base_route' => "entity.field_config.{$field_entity_type}.field_edit_form", ); // Field settings tab. - $this->derivatives["field_edit_$field_entity_type"] = array( - 'route_name' => "field_ui.storage_edit_$field_entity_type", + $this->derivatives["field_storage_$field_entity_type"] = array( + 'route_name' => "entity.field_config.$field_entity_type}.storage_edit_form", 'title' => $this->t('Field settings'), - 'base_route' => "field_ui.field_edit_$field_entity_type", + 'base_route' => "entity.field_config.{$field_entity_type}.field_edit_form", ); // View and form modes secondary tabs. @@ -173,7 +177,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { */ public function alterLocalTasks(&$local_tasks) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { - $field_entity_type = $entity_type->getBundleEntityType() ?: $entity_type_id; + $field_entity_type = $entity_type->getBundleEntityType(); if ($field_entity_type == 'bundle') { $field_entity_type = $entity_type_id; } diff --git a/core/modules/field_ui/src/Routing/RouteSubscriber.php b/core/modules/field_ui/src/Routing/RouteSubscriber.php index 557e6b3..a87c5cf 100644 --- a/core/modules/field_ui/src/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/src/Routing/RouteSubscriber.php @@ -67,7 +67,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_entity_access' => 'field_config.update'), $options ); - $collection->add("entity.field_config.field_ui.field_{$entity_type_id}_edit_form", $route); + $collection->add("entity.field_config.{$entity_type_id}_field_edit_form", $route); $route = new Route( "$path/fields/{field_config}/storage", @@ -75,7 +75,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_entity_access' => 'field_config.update'), $options ); - $collection->add("entity.field_config.field_ui.storage_{$entity_type_id}_edit_form", $route); + $collection->add("entity.field_config.{$entity_type_id}_storage_edit_form", $route); $route = new Route( "$path/fields/{field_config}/delete", @@ -83,7 +83,7 @@ protected function alterRoutes(RouteCollection $collection) { array('_entity_access' => 'field_config.delete'), $options ); - $collection->add("entity.field_config.field_ui.field_{$entity_type_id}_delete_form", $route); + $collection->add("entity.field_config.{$entity_type_id}_field_delete_form", $route); // If the entity type has no bundles, use the entity type. $defaults['entity_type_id'] = $entity_type_id;