diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php index 43530a2..32115ce 100644 --- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php +++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php @@ -233,6 +233,15 @@ class EntityType extends Plugin { public $entity_menu_base_path; /** + * The prefix for the bundles for this entity. + * + * For example, the comment bundle is prefixed with 'comment_node_'. + * + * @var string + */ + public $entity_bundle_prefix; + + /** * The base menu router path to which the entity admin user interface responds. * * It can be used to generate UI links and to attach additional router items diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php index 029868f..986ce42 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Core/Entity/Comment.php @@ -33,6 +33,7 @@ * translatable = TRUE, * static_cache = FALSE, * entity_menu_base_path = "admin/structure/types/manage/{bundle}/comment", + * entity_bundle_prefix = "comment_node_", * entity_keys = { * "id" = "cid", * "bundle" = "node_type", diff --git a/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php index 7ea8391..64f987b 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/OverviewBase.php @@ -46,9 +46,9 @@ * {@inheritdoc} */ public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { - // @todo Comment has its own magical bundle naming. - if ($entity_type == 'comment' && module_exists('comment')) { - $bundle = comment_node_type_load($bundle); + $entity_info = entity_get_info($entity_type); + if (!empty($entity_info['entity_bundle_prefix'])) { + $bundle = $entity_info['entity_bundle_prefix'] . $bundle; } form_load_include($form_state, 'inc', 'field_ui', 'field_ui.admin');