commit 6b1940f828710edbeecd3761749f17fc39ad2fd3 Author: fago Date: Wed Apr 10 12:27:08 2013 +0200 Fixed hal language problems. diff --git a/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php index 2618d9a..a414155 100644 --- a/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php +++ b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php @@ -73,11 +73,16 @@ public function denormalize($data, $class, $format = NULL, array $context = arra throw new UnexpectedValueException('The type link relation must be specified.'); } - // Get language. - $langcode = isset($data['langcode']) ? $data['langcode'][0]['value'] : LANGUAGE_NOT_SPECIFIED; - // Create the entity. $typed_data_ids = $this->getTypedDataIds($data['_links']['type']); + // Figure out the language to use. + if (isset($data['langcode'])) { + $langcode = $data['langcode'][0]['value']; + } + else { + $langcode = language_get_default_langcode($typed_data_ids['entity_type'], $typed_data_ids['bundle']); + } + $entity = entity_create($typed_data_ids['entity_type'], array('langcode' => $langcode, 'type' => $typed_data_ids['bundle'])); // @todo Handle data in _links and _embedded, http://drupal.org/node/1880424