diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php index ba0d120..4d086d1 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php @@ -48,13 +48,15 @@ public function build(ContainerBuilder $container) { // Add Normalizers to service container. foreach ($normalizers as $supported_class => $formats) { foreach ($formats as $format => $normalizer_class) { - $container->register("serializer.normalizer.{$supported_class}.{$format}", $normalizer_class)->addTag('normalizer', array('priority' => $priority)); + $container->register("serializer.normalizer.{$supported_class}.{$format}", $normalizer_class) + ->addTag('normalizer', array('priority' => $priority)); } } // Add Encoders to service container. foreach ($encoders as $format => $encoder_class) { - $container->register("serializer.encoder.{$format}", $encoder_class)->addTag('encoder', array('priority' => $priority)); + $container->register("serializer.encoder.{$format}", $encoder_class) + ->addTag('encoder', array('priority' => $priority)); } } } diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEncoder.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEncoder.php index 1d8fe2c..2b9ed2a 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEncoder.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEncoder.php @@ -18,7 +18,7 @@ class JsonldEncoder extends JsonEncoder implements EncoderInterface { /** - * The formats that this Normalizer supports. + * The formats that this Encoder supports. * * @var array */ diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php index 50a899f..65bf6e0 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php @@ -4,11 +4,11 @@ * @file * Definition of Drupal\jsonld\JsonldEntityWrapper. */ - + namespace Drupal\jsonld; - + use Drupal\Core\Entity\Entity; - + /** * Provide an interface for JsonldNormalizer to get required properties. */ @@ -40,6 +40,10 @@ class JsonldEntityWrapper { * * @param string $entity * The Entity API entity + * @param string $format. + * The format. + * @param \Symfony\Component\Serializer\Serializer $serializer + * The serializer, provided by the SerializerAwareNormaizer. */ public function __construct(Entity $entity, $format, $serializer) { $this->entity = $entity; @@ -72,7 +76,7 @@ public function getProperties() { foreach ($this->entity->getTranslationLanguages() as $langcode => $language) { foreach ($this->entity->getTranslation($langcode) as $name => $field) { $definition = $this->entity->getPropertyDefinition($name); - $langKey = empty($definition['translatable']) ? 'und' : $langcode; + $langKey = empty($definition['translatable']) ? LANGUAGE_NOT_SPECIFIED : $langcode; if (!$field->isEmpty()) { $properties[$name][$langKey] = $this->serializer->normalize($field, $this->format); }