diff --git a/plugins/content_types/form/entity_form_field.inc b/plugins/content_types/form/entity_form_field.inc index 3905a31..583f24a 100644 --- a/plugins/content_types/form/entity_form_field.inc +++ b/plugins/content_types/form/entity_form_field.inc @@ -72,13 +72,23 @@ function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_ar return; } - // Get a shortcut to the entity. - $entity = $context->data; list($entity_type, $field_name) = explode(':', $subtype, 2); - // Load the entity type's information for this field. - $ids = entity_extract_ids($entity_type, $entity); - $field = field_info_instance($entity_type, $field_name, $ids[2]); + // The node add context will have only the type for ->data so we have to make an entity + if (is_object($context->data)) { + // Get a shortcut to the entity. + $entity = $context->data; + + // Load the entity type's information for this field. + $ids = entity_extract_ids($entity_type, $entity); + $field = field_info_instance($entity_type, $field_name, $ids[2]); + } + else { + $bundle = $context->data; + + // Load the entity type's information for this field. + $field = field_info_instance($entity_type, $field_name, $bundle); + } // Do not render if the entity type does not have this field. if (empty($field)) {