From f22bac26063da026b334f31d3d79143f0f846474 Mon Sep 17 00:00:00 2001 From: Pierre Buyle Date: Fri, 9 Sep 2011 14:54:52 +0200 Subject: [PATCH] Issue #1084268 by mori: Exception: Invalid field name given. in FieldCollectionItemEntity (temp. workaround) --- field_collection.module | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/field_collection.module b/field_collection.module index cf2bf30..05775af 100644 --- a/field_collection.module +++ b/field_collection.module @@ -112,9 +112,14 @@ class FieldCollectionItemEntity extends Entity { public function __construct(array $values = array(), $entityType = NULL) { parent::__construct($values, 'field_collection_item'); - $field_info = $this->fieldInfo(); - if (!$field_info || $field_info['type'] != 'field_collection') { - throw new Exception("Invalid field name given."); + // Avoid checking field type if properties are not set yet. + // See http://drupal.org/node/1084268 and http://drupal.org/node/1264440 + // FIXME: Remove when #1264440 is fixed + if (isset($this->field_name)) { + $field_info = $this->fieldInfo(); + if (!$field_info || $field_info['type'] != 'field_collection') { + throw new Exception("Invalid field name given."); + } } } -- 1.7.1