Updated: Comment #0

Problem/Motivation

We still have 2 @todo's in FieldInstanceMapper. Thanks to #2111823: Convert field_ui / Entity local tasks to YAML definitions I just found out about EntityManager::getRouteInfo().

Proposed resolution

We can use that to figure out the route parameters for the base route for field instances. That removes the two @todo's.

Remaining tasks

User interface changes

None.

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tstoeckler’s picture

Status: Needs review » Needs work

Meh, we need the parent entity, of course. Hmm...

Gábor Hojtsy’s picture

FYI the same code is being updated in #2111823: Convert field_ui / Entity local tasks to YAML definitions "similarly":

    */
   public function getBaseRouteParameters() {
     $parameters = parent::getBaseRouteParameters();
-    // @todo All core content entity path placeholders can be fully filled in
-    //   with an additional {bundle} value in their paths, but a more
-    //   predictable solution would be ideal. See
-    //   https://drupal.org/node/2134871
+    $base_entity_info = $this->entityManager->getDefinition($this->pluginDefinition['base_entity_type']);
     // @todo Field instances have no method to return the bundle the instance is
     //   attached to. See https://drupal.org/node/2134861
-    $parameters['bundle'] = $this->entity->bundle;
+    $parameters[$base_entity_info['bundle_entity_type']] = $this->entity->bundle;
     return $parameters;
   }
tstoeckler’s picture

Status: Needs work » Postponed

Yeah, I saw that too. At this point, since that is pretty much done, we should postpone this on that. I still think using getRouteInfo() makes more sense than specifying the $bundle argument ourselves, but I don't want to set that patch back to needs review for that, since it's already an improvement the way it is.

tstoeckler’s picture

Status: Postponed » Needs review
FileSize
1.15 KB

Yeah, so I had the right feel for that.

Here's a re-roll now that that is in.

Also uses the correct parameters now, I hope.

Status: Needs review » Needs work

The last submitted patch, 5: 2139209-5.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
FileSize
106.01 KB

WTF, mate?

tstoeckler’s picture

5: 2139209-5.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 5: 2139209-5.patch, failed testing.

tstoeckler’s picture

Assigned: tstoeckler » Unassigned

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Berdir’s picture

Title: Use EntityManager::getRouteInfo() in ConfigFieldInstanceMapper::getBaseRouteParameters() » Use EntityTypeManager::getRouteInfo() in ConfigFieldInstanceMapper::getBaseRouteParameters()
Version: 8.6.x-dev » 8.8.x-dev
Status: Needs work » Closed (outdated)

The code is now in \Drupal\config_translation\ConfigFieldMapper::getBaseRouteParameters() I think and the @todo is gone, not sure if this is still relevant but that getAdminRouteInfo() method doesn't seem to exist, so closing as outdated, feel free to re-open ;)