public
Created

property

  • Download Gist
I2057227-diff-9-11.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php
index e120d73..eddfa33 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php
@@ -207,6 +207,13 @@ class FieldInstance extends ConfigEntityBase implements FieldInstanceInterface {
*/
public $original = NULL;
+ /**
+ * The plugin manager for entities.
+ *
+ * @var \Drupal\Core\Entity\EntityManager
+ */
+ protected $entityManager;
+
/**
* Constructs a FieldInstance object.
*
@@ -272,6 +279,7 @@ public function __construct(array $values, $entity_type = 'field_instance') {
throw new FieldException(format_string('Attempt to create an instance of field @field_id without a bundle.', array('@field_id' => $this->field->id)));
}
+ $this->entityManager = $this->getEntityManager();
// 'Label' defaults to the field ID (mostly useful for field instances
// created in tests).
@@ -353,7 +361,7 @@ public function save() {
* In case of failures at the configuration storage level.
*/
protected function saveNew() {
- $instance_controller = $this->getEntityManager()->getStorageController($this->entityType);
+ $instance_controller = $this->entityManager->getStorageController($this->entityType);
// Check that the field can be attached to this entity type.
if (!empty($this->field->entity_types) && !in_array($this->entity_type, $this->field->entity_types)) {
@@ -391,7 +399,7 @@ protected function saveNew() {
* In case of failures at the configuration storage level.
*/
protected function saveUpdated() {
- $instance_controller = $this->getEntityManager()->getStorageController($this->entityType);
+ $instance_controller = $this->entityManager->getStorageController($this->entityType);
$original = $instance_controller->loadUnchanged($this->getOriginalID());
$this->original = $original;
@@ -539,7 +547,7 @@ public function isFieldTranslatable() {
* {@inheritdoc}
*/
public function uri() {
- $path = $this->getEntityManager()->getAdminPath($this->entity_type, $this->bundle);
+ $path = $this->entityManager->getAdminPath($this->entity_type, $this->bundle);
return array(
'path' => $path . '/fields/' . $this->id(),
'options' => array(

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.