From 19064ea4f5d92f6a8942fdbfe2c9fcd10e97bd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Kisgy=C3=B6rgy?= Date: Wed, 18 Mar 2015 11:54:16 +0200 Subject: [PATCH] ideas from https://github.com/RESTful-Drupal/restful/issues/376#issuecomment-70479567 --- plugins/restful/RestfulEntityBase.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/restful/RestfulEntityBase.php b/plugins/restful/RestfulEntityBase.php index 41550759..bdc1408e 100644 --- a/plugins/restful/RestfulEntityBase.php +++ b/plugins/restful/RestfulEntityBase.php @@ -460,6 +460,9 @@ protected function getTargetTypeFromEntityReference(\EntityMetadataWrapper $wrap elseif ($field['type'] == 'taxonomy_term_reference') { return 'taxonomy_term'; } + elseif ($field['type'] == 'field_collection') { + return 'field_collection_item'; + } throw new \RestfulException(format_string('Field @property is not an entity reference or taxonomy reference field.', $params)); } @@ -715,6 +718,7 @@ public function propertyValuesPreprocess($property_name, $value, $public_field_n switch ($field_info['type']) { case 'entityreference': case 'taxonomy_term_reference': + case 'field_collection': return $this->propertyValuesPreprocessReference($property_name, $value, $field_info, $public_field_name); case 'text': @@ -1384,6 +1388,7 @@ protected function formSchemaHasAllowedValues($field, $instance) { $field_types = array( 'entityreference', 'taxonomy_term_reference', + 'field_collection', ); $widget_types = array(