Skip to content
Snippets Groups Projects
Commit 56e86dc6 authored by Sviatoslav Smovdyr's avatar Sviatoslav Smovdyr Committed by Pierre Dureau
Browse files

Issue #3481051 by smovs, pdureau: Use Drupal YAML dumper instead of Symfony?

parent 695e2c1b
Branches
Tags
1 merge request!245#3481051 - Used Drupal YAML dumper instead of Symfony.
Pipeline #311951 passed
......@@ -6,6 +6,7 @@ namespace Drupal\ui_patterns_devel\Controller;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Render\MarkupInterface;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\AutowireTrait;
use Drupal\Core\Link;
......@@ -16,7 +17,6 @@ use Drupal\ui_patterns\ComponentPluginManager;
use Drupal\ui_patterns_devel\Validator;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Yaml\Yaml;
/**
* Returns responses for UI Patterns Devel routes.
......@@ -465,7 +465,7 @@ final class ComponentValidatorOverview extends ControllerBase {
'#description' => $this->t('Definition processed by the code before rendering.'),
'#open' => FALSE,
'#weight' => 3,
['#markup' => '<pre><code>' . \htmlentities((string) Yaml::dump($component->getPluginDefinition(), 10, 2)) . '</code></pre>'],
['#markup' => '<pre><code>' . \htmlentities((string) Yaml::encode($component->getPluginDefinition())) . '</code></pre>'],
];
$build['source'] = [
......
......@@ -4,8 +4,8 @@ declare(strict_types=1);
namespace Drupal\ui_patterns_legacy;
use Drupal\Component\Serialization\Yaml;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Yaml\Yaml;
/**
* Component writer.
......@@ -28,7 +28,7 @@ class ComponentWriter {
// - empty objects: Symfony does "{ }", Prettier does "{}"
// - arrays of objects: Symfony adds a line break after dash, Prettier
// doesn't.
$yaml = Yaml::dump($definition, 10, 2);
$yaml = Yaml::encode($definition);
file_put_contents($path . $filename, $yaml);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment