diff --git a/src/Plugin/resource/DataProvider/DataProviderEntity.php b/src/Plugin/resource/DataProvider/DataProviderEntity.php index 8d61bd91..d7d15f1e 100644 --- a/src/Plugin/resource/DataProvider/DataProviderEntity.php +++ b/src/Plugin/resource/DataProvider/DataProviderEntity.php @@ -1124,6 +1124,7 @@ protected function getReferencedId($value, ResourceFieldInterface $resource_fiel $field_info = field_info_field($resource_field->getProperty()); // We support: // - Entity Reference. + // - Commerce Product // - Taxonomy Term. // - File & Image field. // - uid property. @@ -1142,7 +1143,8 @@ protected function getReferencedId($value, ResourceFieldInterface $resource_fiel $target_entity_type = 'taxonomy_vocabulary'; } } - elseif (!empty($field_info['type']) && $field_info['type'] == 'entityreference') { + elseif (!empty($field_info['type']) + elseif (!empty($field_info['type']) && ( $field_info['type'] == 'entityreference' || $field_info['type'] == 'commerce_product_reference') ) { $target_entity_type = $field_info['settings']['target_type']; $bundles = empty($field_info['settings']['handler_settings']['target_bundles']) ? array() : $field_info['settings']['handler_settings']['target_bundles']; } diff --git a/src/Plugin/resource/Field/ResourceFieldEntity.php b/src/Plugin/resource/Field/ResourceFieldEntity.php index 03a4b25b..11491f4d 100644 --- a/src/Plugin/resource/Field/ResourceFieldEntity.php +++ b/src/Plugin/resource/Field/ResourceFieldEntity.php @@ -922,6 +922,7 @@ public static function fieldClassName(array $field_definition) { switch ($field_info['type']) { case 'entityreference': + case 'commerce_product_reference': case 'taxonomy_term_reference': return '\Drupal\restful\Plugin\resource\Field\ResourceFieldEntityReference';