PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.3.4
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.3.4
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 All 66 releases
← All changes | includes/API/CampaignAPI.php +18 -2 2.2.22.3.4 View file →
@@ -284,9 +284,11 @@
284 284 return new WP_REST_Response( $stats, 200 );
285 285 }
286 286
287 287 public function get_templates(): WP_REST_Response {
288 - return new WP_REST_Response( array_values( TemplateManager::get_all() ), 200 );
288 + // The builder's template list — picker-facing, so it must not serve the
289 + // retired designs get_all() still holds for the renderer.
290 + return new WP_REST_Response( array_values( TemplateManager::get_for_picker() ), 200 );
289 291 }
290 292
291 293 public function preview_campaign( WP_REST_Request $request ): WP_REST_Response {
292 294 $post = $this->get_validated_post( $request['id'] );
@@ -321,9 +323,23 @@
321 323 return new WP_REST_Response( [ 'html' => $html ], 200 );
322 324 }
323 325
324 326 public function preview_template( WP_REST_Request $request ): WP_REST_Response {
325 - $key = sanitize_key( $request['key'] );
327 + $key = sanitize_key( $request['key'] );
328 +
329 + // ?document=1 → a standalone HTML document for the picker's Preview
330 + // lightbox iframe (stylesheets, theme class and colours included), rather
331 + // than the bare fragment the original callers expect. It returns '' for a
332 + // template with no layout of its own — a locked Pro card — and the client
333 + // falls back to that template's screenshot.
334 + if ( $request->get_param( 'document' ) ) {
335 + $document = RendererService::build_template_preview_document( $key );
336 + if ( ! $document ) {
337 + return new WP_REST_Response( [ 'message' => 'Template not previewable' ], 404 );
338 + }
339 + return new WP_REST_Response( [ 'html' => $document ], 200 );
340 + }
341 +
326 342 $html = RendererService::render_template_preview( $key );
327 343 if ( ! $html ) {
328 344 return new WP_REST_Response( [ 'message' => 'Template not found' ], 404 );
329 345 }