PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.4.1
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.4.1
2.4.1 2.4.0 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 All 68 releases
← All changes | includes/API/CampaignAPI.php +19 -2 2.3.0 → 2.4.1 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,24 @@
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. A template with no
332 + // layout of its own — a locked Pro card on a free install — has nothing to
333 + // render, so this 404s and the lightbox shows the card's screenshot (the
334 + // builder does not request a locked card's document in the first place).
335 + if ( $request->get_param( 'document' ) ) {
336 + $document = RendererService::build_template_preview_document( $key );
337 + if ( ! $document ) {
338 + return new WP_REST_Response( [ 'message' => 'Template not previewable' ], 404 );
339 + }
340 + return new WP_REST_Response( [ 'html' => $document ], 200 );
341 + }
342 +
326 343 $html = RendererService::render_template_preview( $key );
327 344 if ( ! $html ) {
328 345 return new WP_REST_Response( [ 'message' => 'Template not found' ], 404 );
329 346 }