Yaml.php 611 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Drupal\Core\Serialization;
  3. use Drupal\Core\Site\Settings;
  4. use Drupal\Component\Serialization\Yaml as ComponentYaml;
  5. /**
  6. * Provides a YAML serialization implementation.
  7. *
  8. * Allow settings to override the YAML implementation resolution.
  9. */
  10. class Yaml extends ComponentYaml {
  11. /**
  12. * {@inheritdoc}
  13. */
  14. protected static function getSerializer() {
  15. // Allow settings.php to override the YAML serializer.
  16. if (!isset(static::$serializer) &&
  17. $class = Settings::get('yaml_parser_class')) {
  18. static::$serializer = $class;
  19. }
  20. return parent::getSerializer();
  21. }
  22. }