PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Hooks/Handlers/ShortCodes/ShortCode.php +11 -1 1.4.1 → 1.6.5 View file →
@@ -3,8 +3,9 @@
3 3 namespace FluentCart\App\Hooks\Handlers\ShortCodes;
4 4
5 5 use FluentCart\Api\Contracts\CanEnqueue;
6 6 use FluentCart\App\App;
7 +use FluentCart\App\Services\Renderer\RenderContext;
7 8 use FluentCart\Framework\Support\Arr;
8 9 use FluentCart\Framework\Support\Str;
9 10
10 11 abstract class ShortCode
@@ -51,9 +52,18 @@
51 52
52 53 public static function register()
53 54 {
54 55 add_shortcode(static::getShortCodeName(), function ($shortcodeAttributes, $content, $block) {
55 - return static::make($shortcodeAttributes)->renderShortcode($block);
56 + // WordPress exposes no "shortcode currently rendering" signal, so
57 + // this is the one place that has to say so. Every ShortCode
58 + // subclass registers through here, so it is the only place.
59 + return RenderContext::declaring(
60 + RenderContext::SOURCE_SHORTCODE,
61 + static::getShortCodeName(),
62 + function () use ($shortcodeAttributes, $block) {
63 + return static::make($shortcodeAttributes)->renderShortcode($block);
64 + }
65 + );
56 66 });
57 67 }
58 68
59 69 protected function generateEnqueueSlug(): string