Update to fix value compaction when there is a default language.

This commit is contained in:
Dave Longley 2012-06-12 20:36:12 -04:00
parent f17859714b
commit 2760055bd2

View file

@ -1146,10 +1146,15 @@ class JsonLdProcessor {
if(is_object($element)) { if(is_object($element)) {
// element is a @value // element is a @value
if(self::_isValue($element)) { if(self::_isValue($element)) {
// if @value is the only key, return its value // if @value is the only key
if(count(get_object_vars($element)) === 1) { if(count(get_object_vars($element)) === 1) {
// if there is no default language, return value of @value
if(!property_exists($ctx, '@language')) {
return $element->{'@value'}; return $element->{'@value'};
} }
// return full element
return $element;
}
// get type and language context rules // get type and language context rules
$type = self::getContextValue($ctx, $property, '@type'); $type = self::getContextValue($ctx, $property, '@type');