diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php index 7e7df0f..6efc6b6 100644 --- a/core/modules/comment/src/Tests/CommentTypeTest.php +++ b/core/modules/comment/src/Tests/CommentTypeTest.php @@ -108,7 +108,7 @@ public function testCommentTypeEditing() { $this->drupalGet('admin/structure/comment'); $this->assertRaw('Bar', 'New name was displayed.'); $this->clickLink('Manage fields'); - $this->assertUrl(\Drupal::url('entity.comment_type.field_ui_fields', ['comment_type' => 'comment'], ['absolute' => TRUE]), [], 'Original machine name was used in URL.'); + $this->assertUrl(\Drupal::url('entity.comment.field_ui_fields', ['comment_type' => 'comment'], ['absolute' => TRUE]), [], 'Original machine name was used in URL.'); $this->assertTrue($this->cssSelect('tr#comment-body'), 'Body field exists.'); // Remove the body field. diff --git a/core/modules/field_ui/src/Controller/FieldConfigListController.php b/core/modules/field_ui/src/Controller/FieldConfigListController.php index 4f1a3f0..649e7bb 100644 --- a/core/modules/field_ui/src/Controller/FieldConfigListController.php +++ b/core/modules/field_ui/src/Controller/FieldConfigListController.php @@ -30,10 +30,6 @@ class FieldConfigListController extends EntityListController { * A render array as expected by drupal_render(). */ public function listing($entity_type_id = NULL, $bundle = NULL, RouteMatchInterface $route_match = NULL) { - if (!$bundle) { - $entity_info = $this->entityManager()->getDefinition($entity_type_id); - $bundle = $route_match->getRawParameter($entity_info->getBundleEntityType()); - } return $this->entityManager()->getListBuilder('field_config')->render($entity_type_id, $bundle); } diff --git a/core/modules/field_ui/src/FieldUI.php b/core/modules/field_ui/src/FieldUI.php index 0487bf5..52b3ea8 100644 --- a/core/modules/field_ui/src/FieldUI.php +++ b/core/modules/field_ui/src/FieldUI.php @@ -65,18 +65,4 @@ public static function getNextDestination(array $destinations) { return $next_destination; } - /** - * Gets the bundle entity type used for route names. - * - * This method returns the bundle entity type, in case there is one. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The actual entity type, not the bundle. - * - * @return string - * The used entity type ID in the route name. - */ - public static function getRouteBundleEntityType(EntityTypeInterface $entity_type) { - return $entity_type->getBundleEntityType() != 'bundle' ? $entity_type->getBundleEntityType() : $entity_type->id(); - } } diff --git a/core/modules/field_ui/src/Form/EntityFormDisplayEditForm.php b/core/modules/field_ui/src/Form/EntityFormDisplayEditForm.php index 1c7a2b1..e8f9b95 100644 --- a/core/modules/field_ui/src/Form/EntityFormDisplayEditForm.php +++ b/core/modules/field_ui/src/Form/EntityFormDisplayEditForm.php @@ -11,7 +11,6 @@ use Drupal\Core\Field\PluginSettingsInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; -use Drupal\field_ui\FieldUI; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -108,7 +107,7 @@ protected function getTableHeader() { protected function getOverviewUrl($mode) { $entity_type = $this->entityManager->getDefinition($this->entity->getTargetEntityTypeId()); return Url::fromRoute('entity.entity_form_display.' . $this->entity->getTargetEntityTypeId() . '.form_mode', [ - FieldUI::getRouteBundleEntityType($entity_type) => $this->entity->getTargetBundle(), + $entity_type->getBundleEntityType() => $this->entity->getTargetBundle(), 'form_mode_name' => $mode, ]); } diff --git a/core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php b/core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php index e224da9..e7f403d 100644 --- a/core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php +++ b/core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php @@ -11,7 +11,6 @@ use Drupal\Core\Field\PluginSettingsInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; -use Drupal\field_ui\FieldUI; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -142,7 +141,7 @@ protected function getTableHeader() { protected function getOverviewUrl($mode) { $entity_type = $this->entityManager->getDefinition($this->entity->getTargetEntityTypeId()); return Url::fromRoute('entity.entity_view_display.' . $this->entity->getTargetEntityTypeId() . '.view_mode', [ - FieldUI::getRouteBundleEntityType($entity_type) => $this->entity->getTargetBundle(), + $entity_type->getBundleEntityType() => $this->entity->getTargetBundle(), 'view_mode_name' => $mode, ]); } diff --git a/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php index 4efd667..89c6b2b 100644 --- a/core/modules/field_ui/src/Form/FieldStorageAddForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php @@ -311,7 +311,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $values = $form_state->getValues(); $destinations = array(); $entity_type = $this->entityManager->getDefinition($this->entityTypeId); - $bundle_entity_type_id = FieldUI::getRouteBundleEntityType($entity_type); + $bundle_entity_type_id = $entity_type->getBundleEntityType(); // Create new field. if ($values['new_storage_type']) { diff --git a/core/modules/field_ui/src/Routing/RouteSubscriber.php b/core/modules/field_ui/src/Routing/RouteSubscriber.php index 2605e69..0904027 100644 --- a/core/modules/field_ui/src/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/src/Routing/RouteSubscriber.php @@ -59,9 +59,12 @@ protected function alterRoutes(RouteCollection $collection) { $defaults = array( 'entity_type_id' => $entity_type_id, - // If the entity type has no bundles, use the entity type. - 'bundle' => !$entity_type->hasKey('bundle') ? $entity_type_id : '', ); + // If the entity type has no bundles and it doesn't use {bundle} in its + // admin path, use the entity type. + if (strpos($path, '{bundle}') === FALSE) { + $defaults['bundle'] = !$entity_type->hasKey('bundle') ? $entity_type_id : ''; + } $route = new Route( "$path/fields/{field_config}",