MetatagHalNormalizer.php 556 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Drupal\metatag\Normalizer;
  3. /**
  4. * Converts the Metatag field item object structure to Metatag array structure.
  5. */
  6. class MetatagHalNormalizer extends MetatagNormalizer {
  7. /**
  8. * {@inheritdoc}
  9. */
  10. protected $format = ['hal_json'];
  11. /**
  12. * {@inheritdoc}
  13. */
  14. public function normalize($field_item, $format = NULL, array $context = []) {
  15. $normalized = parent::normalize($field_item, $format, $context);
  16. // Mock the field array similar to the other fields.
  17. return [
  18. 'metatag' => [$normalized],
  19. ];
  20. }
  21. }