diff --git a/core/modules/config_translation/lib/Drupal/config_translation/ConfigFieldInstanceMapper.php b/core/modules/config_translation/lib/Drupal/config_translation/ConfigFieldInstanceMapper.php index be497e4..44df444 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/ConfigFieldInstanceMapper.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/ConfigFieldInstanceMapper.php @@ -19,14 +19,19 @@ class ConfigFieldInstanceMapper extends ConfigEntityMapper { /** + * Loaded entity instance to help produce the translation interface. + * + * @var \Drupal\field\FieldInstanceInterface + */ + protected $entity; + + /** * {@inheritdoc} */ public function getBaseRouteParameters() { $parameters = parent::getBaseRouteParameters(); $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[$base_entity_info['bundle_entity_type']] = $this->entity->bundle; + $parameters[$base_entity_info['bundle_entity_type']] = $this->entity->targetBundle(); return $parameters; } diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php index 3af2671..bf0bfbf 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php @@ -588,6 +588,13 @@ public function allowBundleRename() { $this->bundle_rename_allowed = TRUE; } + /** + * {@inheritdoc} + */ + public function targetBundle() { + return $this->bundle; + } + /* * Implements the magic __sleep() method. * diff --git a/core/modules/field/lib/Drupal/field/FieldInstanceInterface.php b/core/modules/field/lib/Drupal/field/FieldInstanceInterface.php index aa06b83..f5df93b 100644 --- a/core/modules/field/lib/Drupal/field/FieldInstanceInterface.php +++ b/core/modules/field/lib/Drupal/field/FieldInstanceInterface.php @@ -32,4 +32,12 @@ public function getField(); */ public function allowBundleRename(); + /** + * Returns the name of the bundle this field instance is attached to. + * + * @return string + * The name of the bundle this field instance is attached to. + */ + public function targetBundle(); + }