Repository navigation
Fix: Ensure player styles are correctly enqueued for image shortcode - #2121
Conversation
Ensure the godam-player-wrapper-style will always enque regardless of godam-player-style style was enqued by image or video block
There was a problem hiding this comment.
🟢 Approval recommended
The style dependency is consistently applied across the affected block, shortcode, and editor paths.
Pull request overview
Ensures player wrapper CSS loads reliably for image blocks and shortcodes, preventing video sizing issues caused by style registration order.
Changes:
- Adds wrapper CSS as a player-style dependency for image blocks.
- Explicitly enqueues wrapper CSS for image shortcode and WPBakery paths.
File summaries
| File | Description |
|---|---|
inc/classes/class-blocks.php |
Declares the wrapper stylesheet dependency. |
inc/classes/shortcodes/class-godam-image.php |
Enqueues wrapper styles for shortcode rendering. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
missing_composer_json_file | The "/vendor" directory using composer exists, but "composer.json" file is missing. |
📁 readme.txt (2 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM". |
0 |
trademarked_term | The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name. |
📁 assets/build/blocks/godam-gallery-v2/render.php (2 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
15 |
WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$inner_block_video_ids". |
23 |
WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$inner_block_video_ids". |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/09/15/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/09/15/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
|
Reviewed. Correct fix, verified end to end. I traced the mechanism against WP core and the plugin boot order, and the diagnosis and the fix both hold. Why the fix is right
Two small, non-blocking notes
LGTM. |
subodhr258
left a comment
There was a problem hiding this comment.
Approved. Fix verified end to end against WP core and the plugin boot order; the wrapper dependency now resolves at print time in both classic and block themes. The two notes on the review comment are optional and non-blocking.
… builds This will solves the woo layers not rendering if godam image, and video blocks exist on same page with woo layers
There was a problem hiding this comment.
🔵 Needs a closer look
The frontend shortcode path may enqueue wrapper styles after wp_head, so the promised sizing CSS is not guaranteed.
Review details
Suppressed comments (1)
inc/classes/shortcodes/class-godam-image.php:149
- This enqueue is still inside
render(), which normally runs whilethe_contentis rendered afterwp_head; the only earlier preload returns unlessvc_is_inline()is true. On a normal frontend[godam_image]shortcode,godam-player-wrapper-stylecan therefore be queued too late to be printed, so this does not guarantee the promised sizing CSS. Register/enqueue this handle on an earlier frontend hook (or explicitly arrange a footer-safe output path) for pages that can contain the shortcode.
wp_enqueue_style( 'godam-player-wrapper-style' );
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
subodhr258
left a comment
There was a problem hiding this comment.
Re-reviewed after the post-approval commit e198496 (layer-registry.js). This is a separate fix from the CSS enqueue work: it moves the layer registry into a shared window store so every godam-player bundle reads the same registrations, instead of each entry bundle keeping a private module-scoped registry. That correctly fixes Woo hotspots not rendering when a godam/image and a godam/video block share a page (before this, only the bundle that drained godamLayerRegistryQueue populated its own copy, and the other bundle's getLayerManager() read an empty registry).
Checked:
- Every accessor now routes through
getStore(); nothing still points at the old module-scoped object. - The render gate (
layersManager->getLayerManager()->new customManagerClass) reads the shared store, so the fix reaches the real code path, not just registration. - No in-repo
addLayerRegistryHookcallers, so sharing thehooksarray does not cause double-firing. assets/build/is gitignored, so the src-only change is correct.
Approving. Two non-blocking follow-ups:
- Please update the PR title/description. They still describe only the CSS enqueue change, not this layer-registry fix, which is the larger part now.
- Minor/latent:
__godamLayerRegistryStoreis an unversioned key, so it is shared across bundle versions that co-load during an upgrade (old cached bundle + newly served bundle on the same page). No issue today since the store shape is stable; worth namespacing the key by version if that shape ever changes.
On the Copilot note about class-godam-image.php enqueuing the wrapper style inside render(): styles enqueued during the_content are printed in the footer, so the CSS is still applied, and all three styles there share the same timing. Fine as is; an earlier frontend hook would only remove a possible brief layout shift.
There was a problem hiding this comment.
🔵 Needs a closer look
The explicit shortcode stylesheet enqueues described by the PR are absent, leaving the fix incomplete.
Review details
Suppressed comments (1)
inc/classes/class-blocks.php:84
- The shortcode portion described in this PR is not present in the submitted changes:
class-godam-image.phpstill has bothpreload_wpbakery_editor_assets()andrender()enqueue onlygodam-image-styleandgodam-player-style. This block-style dependency does not itself add the explicit wrapper enqueue for shortcode paths, so a pre-registeredgodam-player-stylewithout this dependency can still leave the shortcode without the wrapper CSS; add the two shortcode enqueues (or include the equivalent change) before relying on this fix.
'deps' => array( 'godam-player-wrapper-style' ),
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
There was a problem hiding this comment.
🔵 Needs a closer look
The shortcode style paths remain uncovered, and the cross-bundle registry behavior needs documentation and testing.
Review details
Suppressed comments (2)
assets/src/js/godam-player/utils/layer-registry.js:19
- This hunk changes cross-bundle add-on registration semantics by introducing a window-persistent global store, but neither the PR description nor the v2.2.2 changelog mentions this behavior. It is a separate runtime change from the stylesheet dependency fix and can affect every custom-layer add-on; please split it into a focused PR or document and test the mixed-bundle load-order contract before merging.
const STORE_KEY = '__godamLayerRegistryStore';
inc/classes/class-blocks.php:84
- This dependency is applied only to the
godam/imageblock-style registration. The shortcode enqueue paths ininc/classes/shortcodes/class-godam-image.phpstill enqueuegodam-player-stylewithoutgodam-player-wrapper-style, so the shortcode half of the stated fix is not present; in a shortcode-only or builder path that does not run this block-style callback, the aspect-ratio/poster CSS is still not guaranteed. Please add the wrapper enqueue to bothpreload_wpbakery_editor_assets()andrender()(or otherwise make the shared registration cover those paths).
'deps' => array( 'godam-player-wrapper-style' ),
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite (auto)
Note
Copilot is running an experiment and ran this review at Lite.
subodhr258
left a comment
There was a problem hiding this comment.
Approving. Reviewed both changes end to end and the fix is correct.
class-blocks.php Declaring godam-player-wrapper-style as a dep of the godam/image block's godam-player-style registration correctly mirrors the canonical registration in class-godam-player.php. On a page carrying both a godam/video and a godam/image block, enqueue_block_assets registered godam-player-style first on classic themes, so the canonical wp_register_style() (which carries the wrapper dep) became a silent no-op and the wrapper CSS was dropped, leaving the video poster at its natural oversized height. Declaring the same dep in both places makes it registration-order independent. The wrapper handle is registered unconditionally by the always-booted player shortcode class, so it resolves at print time, and WordPress drops an unregistered dep silently, so there is no regression risk.
layer-registry.js Moving the store to a window-backed singleton is the right fix and at the right altitude. The player build and the image-layers build each carry their own module copy of this file; with a module-local store, if the image build won the init race the Woo manager registered into the image build's store while the player's own getLayerManager() read an empty store, so Woo hotspots never rendered on the video. Routing every accessor through getStore() makes all copies read and write one shared store regardless of bundle load order. The non-browser fallback is fine, and nothing depends on the old store reference.
Non-blocking notes:
- The PR description still documents the
class-godam-image.phpenqueue approach, which was reverted in "Remove redundant player wrapper style enqueue in GoDAM Image shortcode". Please update the description to the current two-part fix (block-style dep plus shared registry store) so the squash-merge record is accurate. - "Run PHPCS inspection" is red because the action hit the GitHub API rate limit (
x-ratelimit-remaining: 0) and aborted before scanning, not because of a violation. PHPCS is clean locally on both files. Re-run that job to get it green before merging. - Optional: consider a "Fix:" changelog line for v2.2.2, since the oversized poster and the missing Woo hotspots are user visible.
This pull request addresses a CSS dependency issue that could cause incorrect video sizing when both image and video blocks or shortcodes are present on a page. The changes ensure that the
godam-player-wrapper-style(which contains the aspect-ratio and poster rules) is always loaded as a dependency for the player and image components, regardless of registration order. This prevents missing styles and layout issues.Dependency and style loading improvements:
class-blocks.php, thegodam-player-styleblock style now explicitly declares a dependency ongodam-player-wrapper-style, ensuring the wrapper CSS is always loaded, even if style registration order varies between classic and block themes.class-godam-image.php, both thepreload_wpbakery_editor_assetsandrendermethods now explicitly enqueuegodam-player-wrapper-stylealongsidegodam-player-styleandgodam-image-style, guaranteeing that the required aspect-ratio and poster rules are present for shortcodes as well as blocks. [1] [2]Screen.Recording.2026-09-15.at.10.39.39.AM.mov