Commit 9145204f authored by webchick's avatar webchick

Issue #2134861 by Gábor Hojtsy, amateescu: Field instance bundle is only...

Issue #2134861 by Gábor Hojtsy, amateescu: Field instance bundle is only accessible directly on the bundle property.
parent d370d5f6
......@@ -18,15 +18,20 @@
*/
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;
}
......
......@@ -597,6 +597,13 @@ public function allowBundleRename() {
$this->bundle_rename_allowed = TRUE;
}
/**
* {@inheritdoc}
*/
public function targetBundle() {
return $this->bundle;
}
/*
* Implements the magic __sleep() method.
*
......
......@@ -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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment