Skip to content

Commit

Permalink
fixup! added Sonata generated administration with few basic functiona…
Browse files Browse the repository at this point in the history
…lities
  • Loading branch information
TomasLudvik committed May 21, 2024
1 parent 36c0c5e commit e94eff6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
"patches": {
"composer-exit-on-patch-failure": true,
"twig/twig": {
"Hotfix for issue https://github.com/sonata-project/SonataAdminBundle/issues/8181": "https://github.com/TomasLudvik/Twig/commit/4e07748eb6d427688221e2c7b6dc8872c6d9065c.patch"
"Hotfix for issue https://github.com/sonata-project/SonataAdminBundle/issues/8181": "packages/administration/src/Twig/sonata.patch"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/administration/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"patches": {
"composer-exit-on-patch-failure": true,
"twig/twig": {
"Hotfix for issue https://github.com/sonata-project/SonataAdminBundle/issues/8181": "https://github.com/TomasLudvik/Twig/commit/4e07748eb6d427688221e2c7b6dc8872c6d9065c.patch"
"Hotfix for issue https://github.com/sonata-project/SonataAdminBundle/issues/8181": "packages/administration/src/Twig/sonata.patch"
}
}
}
Expand Down
41 changes: 41 additions & 0 deletions packages/administration/src/Twig/sonata.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 4e07748eb6d427688221e2c7b6dc8872c6d9065c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Toma=CC=81s=CC=8C=20Ludvik?= <tomas.ludvik@shopsys.com>
Date: Mon, 13 May 2024 12:49:02 +0200
Subject: [PATCH] hotfix for
https://github.com/sonata-project/SonataAdminBundle/issues/8181

---
composer.json | 1 +
src/Template.php | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index 57ba92964..f707eae5a 100644
--- a/composer.json
+++ b/composer.json
@@ -24,6 +24,7 @@
}
],
"require": {
+ "ext-json": "*",
"php": ">=7.2.5",
"symfony/polyfill-php80": "^1.22",
"symfony/deprecation-contracts": "^2.5|^3",
diff --git a/src/Template.php b/src/Template.php
index e08837737..6a2b9eba8 100644
--- a/src/Template.php
+++ b/src/Template.php
@@ -429,7 +429,12 @@ public function yieldBlock($name, array $context, array $blocks = [], $useBlocks

foreach ($template->$block($context, $blocks) as $data) {
if (ob_get_length()) {
- $data = ob_get_clean().$data;
+ if (is_string($data) || $data instanceof \JsonSerializable) {
+ $data = ob_get_clean() . $data;
+ } else {
+ $data = ob_get_clean();
+ }
+
ob_start();
}

0 comments on commit e94eff6

Please sign in to comment.