PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.13.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.13.0
2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 All 80 releases
← All changes | includes/blocks.php +38 -0 2.10.02.13.0 View file →
@@ -22,8 +22,14 @@
22 22 // Assets Generator
23 23 add_action( 'save_post', [ $self, 'generate_block_assets' ], 10, 3 );
24 24 add_action( 'switch_theme', [ $self, 'clear_generated_block_assets' ] );
25 25 add_action( 'save_post', [ $self, 'download_google_fonts_locally' ], 20, 3 );
26 + add_action( 'deleted_post', [ $self, 'flush_site_fonts_on_delete' ], 10, 2 );
27 + // Self-hosting template fonts discovered on a front-end request happens
28 + // here, off the visitor's request.
29 + add_action( 'ablocks/download_site_fonts', [ '\ABlocks\Classes\FontCollector', 'update_site_fonts' ] );
30 + // A theme swap changes which templates and template parts exist.
31 + add_action( 'switch_theme', [ '\ABlocks\Classes\FontCollector', 'flush_site_fonts' ] );
26 32 // PERF-2: pre-warm the page's generated assets in the background after save,
27 33 // so the first visitor doesn't pay the parse/generate/write cost.
28 34 add_action( 'save_post', [ $self, 'prewarm_page_assets' ], 30, 3 );
29 35 // Recompute global typography fonts whenever the plugin's global settings change.
@@ -119,8 +125,14 @@
119 125
120 126 new \ABlocks\Blocks\Container\Block();
121 127 new \ABlocks\Blocks\Heading\Block();
122 128 new \ABlocks\Blocks\Paragraph\Block();
129 + new \ABlocks\Blocks\AtomicText\Block();
130 + new \ABlocks\Blocks\AtomicImage\Block();
131 + new \ABlocks\Blocks\AtomicSvg\Block();
132 + new \ABlocks\Blocks\AtomicDiv\Block();
133 + new \ABlocks\Blocks\AtomicFlex\Block();
134 + new \ABlocks\Blocks\AtomicGrid\Block();
123 135 new \ABlocks\Blocks\Image\Block();
124 136 new \ABlocks\Blocks\Button\Block();
125 137 new \ABlocks\Blocks\DualButton\Block();
126 138 new \ABlocks\Blocks\Icon\Block();
@@ -214,8 +226,12 @@
214 226 public function register_block_category( $categories, $post ) {
215 227 return array_merge(
216 228 [
217 229 [
230 + 'slug' => 'ablocks-atomic',
231 + 'title' => __( 'aBlocks Atomic', 'ablocks' ),
232 + ],
233 + [
218 234 'slug' => 'ablocks',
219 235 'title' => __( 'ABlocks', 'ablocks' ),
220 236 ],
221 237 [
@@ -304,8 +320,30 @@
304 320 // Collect the fonts this post actually uses from its saved attributes,
305 321 // cache them in post meta, and self-host them locally.
306 322 // See docs/FONT-MANAGEMENT-PLAN.md.
307 323 \ABlocks\Classes\FontCollector::save_post_fonts( $post_id );
324 +
325 + // Templates, template parts and theme builder layouts render on pages that
326 + // are not the queried post, so their fonts are tracked site-wide. Recompute
327 + // (and download) here rather than on a visitor's request.
328 + if ( in_array( get_post_type( $post_id ), \ABlocks\Classes\FontCollector::get_site_font_post_types(), true ) ) {
329 + \ABlocks\Classes\FontCollector::update_site_fonts();
330 + }
331 + }
332 +
333 + /**
334 + * Deleting a template/part/layout can remove the last user of a font.
335 + *
336 + * @param int $post_id Post being deleted.
337 + * @param \WP_Post $post The deleted post — by this point it is gone from the
338 + * database, so the type has to come from here.
339 + */
340 + public function flush_site_fonts_on_delete( $post_id, $post = null ) {
341 + $post_type = $post instanceof \WP_Post ? $post->post_type : get_post_type( $post_id );
342 +
343 + if ( in_array( $post_type, \ABlocks\Classes\FontCollector::get_site_font_post_types(), true ) ) {
344 + \ABlocks\Classes\FontCollector::flush_site_fonts();
345 + }
308 346 }
309 347
310 348 /**
311 349 * Pre-warm a published page's combined CSS/JS in the background after save,