PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.1.5
Tableberg – Simple Gutenberg Table Block v1.1.5
1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 All 42 releases
← All changes | renderer/Image/ImageRenderer.php +15 -1 1.1.21.1.5 View file →
@@ -157,11 +157,25 @@
157 157 if ($attrs->scale->isNotEmpty()) {
158 158 $blockAttrs['scale'] = $attrs->scale->dangerouslyUseRawValue();
159 159 }
160 160
161 + // block_core_image_render_lightbox() type-hints a real WP_Block, not
162 + // just any object with a `context` property — a plain stdClass
163 + // fatals with a TypeError. Reusing the registered `core/image` name
164 + // gives it a real block type without side effects: the function
165 + // only reads `$block_instance->context`, which stays empty here
166 + // same as it would for a standalone (non-gallery) image.
167 + $blockInstance = class_exists('WP_Block')
168 + ? new \WP_Block(['blockName' => 'core/image', 'attrs' => $blockAttrs])
169 + : null;
170 +
171 + if (!$blockInstance) {
172 + return $figureHtml;
173 + }
174 +
161 175 return \block_core_image_render_lightbox(
162 176 $figureHtml,
163 177 ['attrs' => $blockAttrs],
164 - (object) ['context' => []]
178 + $blockInstance
165 179 );
166 180 }
167 181 }