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/classes/register-scripts.php +17 -1 2.8.12.13.0 View file →
@@ -77,8 +77,20 @@
77 77 public static function get_register_scripts() {
78 78 $script_loading_strategy = \ABlocks\Helper::get_script_loading_strategy();
79 79 $args = [ 'strategy' => $script_loading_strategy ];
80 80 return apply_filters('ablocks/register_scripts', [
81 + // Data-only handle (no src) that hosts the single frontend
82 + // ABlocksGlobal payload. Every aBlocks frontend script depends on it
83 + // — directly, or transitively through ablocks-common-script — so WP
84 + // prints the object exactly once per page instead of once per block
85 + // script handle (asset-generation off) or once per combined template
86 + // script (asset-generation on). See Assets::localize_globals_once().
87 + 'ablocks-globals' => [
88 + 'url' => false,
89 + 'deps' => array(),
90 + 'ver' => ABLOCKS_VERSION,
91 + 'args' => array(),
92 + ],
81 93 'ablocks-prism-script' => [
82 94 'path' => ABLOCKS_ASSETS_PATH . 'library/prism/prism.js',
83 95 'url' => ABLOCKS_ASSETS_URL . 'library/prism/prism.js',
84 96 'deps' => array(),
@@ -137,9 +149,13 @@
137 149 ],
138 150 'ablocks-common-script' => [
139 151 'path' => ABLOCKS_ASSETS_PATH . 'build/blocks-common.js',
140 152 'url' => ABLOCKS_ASSETS_URL . 'build/blocks-common.js',
141 - 'deps' => array(),
153 + // Every block script depends on this handle (see
154 + // BlockBaseAbstract::get_script_depends), so hanging
155 + // ablocks-globals off it makes the payload reachable from any
156 + // rendered block without touching each block's own deps.
157 + 'deps' => array( 'ablocks-globals' ),
142 158 'ver' => false,
143 159 'args' => $args,
144 160 'dependencies' => ABLOCKS_ASSETS_PATH . 'build/blocks-common.asset.php'
145 161 ],