#1946404: Convert forms in field_ui.admin.inc to the new form interface removed 90% of the Field UI 'admin' section of hook_entity_bundle_info(), leaving only 'real path', which is used almost exclusively by Field UI confirmation forms and the "Field List" admin reports page.

At this point it can be automatically derived, no more need for module developers to specify it manually.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Status: Active » Needs review
FileSize
13.05 KB

This path actually has nothing to do with the Field UI, it's about the Entity itself.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Awesome! Also we need to unify uri() entity_uri mess

tim.plunkett’s picture

Yeah, this has nothing to do with entities, just entity types.

When this was decoupled from entity_get_info(), there was no longer any need to access config files directly.
Also fixing user and hook.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, real-path-1982088-3.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
2.17 KB
14.8 KB

I forgot about hook_field_extra_fields and its ilk. Reverting the entity_load_multiple bits.

andypost’s picture

+++ b/core/modules/block/custom_block/custom_block.moduleundefined
@@ -184,12 +184,7 @@ function custom_block_entity_bundle_info() {
   foreach (config_get_storage_names_with_prefix('custom_block.type.') as $config_name) {

+++ b/core/modules/contact/contact.moduleundefined
@@ -176,13 +176,7 @@ function contact_entity_bundle_info() {
   foreach (config_get_storage_names_with_prefix('contact.category.') as $config_name) {

+++ b/core/modules/node/node.moduleundefined
@@ -213,15 +213,10 @@ function node_entity_view_mode_info() {
   foreach (node_type_get_names() as $type => $name) {

+++ b/core/modules/taxonomy/taxonomy.moduleundefined
@@ -125,12 +125,7 @@ function taxonomy_entity_bundle_info() {
   foreach (taxonomy_vocabulary_get_names() as $id) {

a lot of inconsistency for follow-ups

ParisLiakos’s picture

awesome cleanup!

+++ b/core/lib/Drupal/Core/Entity/EntityManager.phpundefined
@@ -200,4 +200,31 @@ public function getAccessController($entity_type) {
+    if (isset($entity_info['route_base_path'])) {
+      // If the entity type has a bundle prefix, strip it out of the path.
+      if (isset($entity_info['bundle_prefix'])) {
+        $bundle = str_replace($entity_info['bundle_prefix'], '', $bundle);
+      }
+      // Replace any dynamic 'bundle' portion of the path with the actual bundle.
+      $admin_path = str_replace('{bundle}', $bundle, $entity_info['route_base_path']);

what happens here if there is no bundle_prefix, besides $bundle being undefined?

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

yea, apparently i missed the $bundle argument:)

webchick’s picture

Status: Reviewed & tested by the community » Needs work

This will need a re-roll for #1982984: Create Drupal::entityManager for improved DX.

Apart from that, this looks like a great clean-up to me.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
2.31 KB
14.74 KB

Reroll!

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

looks good:)

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 50ae329 and pushed to 8.x. Thanks!

tim.plunkett’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.