+ class="Setono\SyliusCalloutPlugin\CssBuilder\SemanticUiCssClassBuilder">
+
+
+
+
+
+
+
+
diff --git a/src/Resources/config/services/twig.xml b/src/Resources/config/services/twig.xml
index 3b54270..1293dca 100644
--- a/src/Resources/config/services/twig.xml
+++ b/src/Resources/config/services/twig.xml
@@ -17,6 +17,7 @@
+
diff --git a/src/Resources/views/Shop/Product/Callout/_callout.html.twig b/src/Resources/views/Shop/Product/Callout/_callout.html.twig
index 0e00879..ec3d825 100755
--- a/src/Resources/views/Shop/Product/Callout/_callout.html.twig
+++ b/src/Resources/views/Shop/Product/Callout/_callout.html.twig
@@ -1,2 +1,2 @@
{# @var \Setono\SyliusCalloutPlugin\Model\CalloutInterface callout #}
-{{ render_callout(callout) }}
+{{ render_callout(callout) }}
diff --git a/src/Twig/CalloutExtension.php b/src/Twig/CalloutExtension.php
index 14e9511..f56f71d 100644
--- a/src/Twig/CalloutExtension.php
+++ b/src/Twig/CalloutExtension.php
@@ -20,6 +20,7 @@ public function getFunctions(): array
new TwigFunction('get_callout_assignment_delay', $this->getDelay(...)),
new TwigFunction('render_callout_class_attribute', [CalloutRuntime::class, 'renderCalloutClassAttribute']),
new TwigFunction('render_callout', [CalloutRuntime::class, 'renderCallout'], ['is_safe' => ['html']]),
+ new TwigFunction('render_callout_style', [CalloutRuntime::class, 'renderCalloutStyle']),
];
}
diff --git a/src/Twig/CalloutRuntime.php b/src/Twig/CalloutRuntime.php
index dc03002..19b6c97 100644
--- a/src/Twig/CalloutRuntime.php
+++ b/src/Twig/CalloutRuntime.php
@@ -6,7 +6,8 @@
use Setono\SyliusCalloutPlugin\Checker\Eligibility\CalloutEligibilityCheckerInterface;
use Setono\SyliusCalloutPlugin\Checker\RenderingEligibility\CalloutRenderingEligibilityCheckerInterface;
-use Setono\SyliusCalloutPlugin\CssClassBuilder\CssClassBuilderInterface;
+use Setono\SyliusCalloutPlugin\CssBuilder\CssClassBuilderInterface;
+use Setono\SyliusCalloutPlugin\CssBuilder\CssStyleBuilderInterface;
use Setono\SyliusCalloutPlugin\Model\CalloutInterface;
use Setono\SyliusCalloutPlugin\Model\ProductInterface;
use Setono\SyliusCalloutPlugin\Provider\RenderingCalloutProviderInterface;
@@ -21,6 +22,7 @@ public function __construct(
private readonly CssClassBuilderInterface $cssClassBuilder,
private readonly RenderingCalloutProviderInterface $renderingCalloutProvider,
private readonly CalloutRendererInterface $calloutRenderer,
+ private readonly CssStyleBuilderInterface $cssStyleBuilder,
) {
}
@@ -76,4 +78,9 @@ public function renderCallout(CalloutInterface $callout): string
{
return (string) $this->calloutRenderer->render($callout);
}
+
+ public function renderCalloutStyle(CalloutInterface $callout): string
+ {
+ return $this->cssStyleBuilder->build($callout);
+ }
}
diff --git a/tests/Twig/CalloutRuntimeTest.php b/tests/Twig/CalloutRuntimeTest.php
index ee38eb5..cb2bf56 100644
--- a/tests/Twig/CalloutRuntimeTest.php
+++ b/tests/Twig/CalloutRuntimeTest.php
@@ -9,7 +9,8 @@
use Prophecy\PhpUnit\ProphecyTrait;
use Setono\SyliusCalloutPlugin\Checker\Eligibility\CalloutEligibilityCheckerInterface;
use Setono\SyliusCalloutPlugin\Checker\RenderingEligibility\CalloutRenderingEligibilityCheckerInterface;
-use Setono\SyliusCalloutPlugin\CssClassBuilder\CssClassBuilderInterface;
+use Setono\SyliusCalloutPlugin\CssBuilder\CssClassBuilderInterface;
+use Setono\SyliusCalloutPlugin\CssBuilder\CssStyleBuilderInterface;
use Setono\SyliusCalloutPlugin\Model\Callout;
use Setono\SyliusCalloutPlugin\Model\CalloutInterface;
use Setono\SyliusCalloutPlugin\Model\ProductInterface;
@@ -76,6 +77,7 @@ private function getCalloutRuntime(): CalloutRuntime
;
$calloutRenderer = $this->prophesize(CalloutRendererInterface::class);
+ $cssStyleBuilder = $this->prophesize(CssStyleBuilderInterface::class);
return new CalloutRuntime(
$calloutRenderingEligibilityChecker->reveal(),
@@ -83,6 +85,7 @@ private function getCalloutRuntime(): CalloutRuntime
$cssClassBuilder->reveal(),
$renderCalloutProvider->reveal(),
$calloutRenderer->reveal(),
+ $cssStyleBuilder->reveal(),
);
}