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/Campaign/CampaignBlock.php +17 -5 2.2.2 → 2.4.1 View file →
@@ -20,10 +20,10 @@
20 20 if ( ! function_exists( 'register_block_type' ) ) {
21 21 return;
22 22 }
23 23
24 - $assets_dir = BETTER_PAYMENT_PATH . '/assets/blocks/campaign-display/';
25 - $src_dir = BETTER_PAYMENT_PATH . '/src/blocks/campaign-display/';
24 + $root = BETTER_PAYMENT_PATH;
25 + $assets_dir = $root . '/assets/blocks/campaign-display/';
26 26
27 27 // Load dependency manifest generated by the blocks webpack build.
28 28 $asset_file = file_exists( $assets_dir . 'index.min.asset.php' )
29 29 ? require $assets_dir . 'index.min.asset.php'
@@ -57,11 +57,20 @@
57 57 $asset_file['version']
58 58 );
59 59 }
60 60
61 - // block.json lives in src/ — fall back gracefully in dev.
62 - $block_json = file_exists( $src_dir . 'block.json' ) ? $src_dir : null;
63 - if ( ! $block_json ) {
61 + // Use the assets/ copy of block.json, because src/ is excluded from the
62 + // release zip and from `git archive` (.distignore / .gitattributes). Reading
63 + // it only from src/ meant this block never registered in a distributed build.
64 + // Same resolution order as BlockManager::register_single_block().
65 + $block_json = $root . '/assets/blocks/blocks/campaign-display/';
66 +
67 + // Fall back to src/ in a dev checkout where the blocks build has not run.
68 + if ( ! file_exists( $block_json . 'block.json' ) ) {
69 + $block_json = $root . '/src/blocks/campaign-display/';
70 + }
71 +
72 + if ( ! file_exists( $block_json . 'block.json' ) ) {
64 73 return;
65 74 }
66 75
67 76 register_block_type(
@@ -93,8 +102,11 @@
93 102
94 103 if ( ! wp_script_is( 'fundraising-campaign-script', 'enqueued' ) ) {
95 104 wp_enqueue_script( 'fundraising-campaign-script' );
96 105 }
106 +
107 + // WordPress enqueues the block's own `style` handle; theme CSS goes on top.
108 + CampaignStyles::enqueue_theme_styles( 'frontend' );
97 109
98 110 return RendererService::render_campaign( $campaign_id );
99 111 }
100 112 }