Skip to content

Conversation

@Arukuen
Copy link
Contributor

@Arukuen Arukuen commented Feb 5, 2026

fixes #24

Summary by CodeRabbit

  • New Features

    • Frontend assets now enqueue automatically so required scripts and styles load on both site and admin pages.
  • Bug Fixes

    • File selection and uploads are now restricted to supported locations, preventing unintended conversion/processing for disallowed drop targets.

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Adds frontend asset enqueuing by registering wp_enqueue_scripts in the script loader constructor, and centralizes file-selection gating in the media manager JS by introducing an ALLOWED_LOCATIONS filter-based list to determine where file-selection handling runs.

Changes

Cohort / File(s) Summary
Frontend Asset Enqueuing
src/admin/class-script-loader.php
Registers wp_enqueue_scripts in the Cimo_Script_Loader constructor so Cimo assets can be enqueued on the frontend as well as in admin contexts.
File Selection Gating (Media Manager JS)
src/admin/js/media-manager/select-files.js
Adds ALLOWED_LOCATIONS defined via applyFilters('cimo.selectFiles.allowedLocations', [...]) and replaces multiple closest(...) checks with a single isAllowed check to gate file-selection/processing to allowed drop targets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through code with careful paws,
Hooks now reach beyond the admin walls.
A filtered list keeps drops in line,
Quiet and tidy, code feels fine—
A little hop, a tiny cause. 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 4
❌ Failed checks (3 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions 'custom fields and form plugins integration' which is broadly related to the PR objectives, but the actual changes only address frontend asset loading and file selection filtering—not integration implementation. Update the title to reflect the actual changes, such as 'feat: enable frontend asset loading and filter file selection locations' or similar.
Linked Issues check ⚠️ Warning The code changes (frontend asset loading and file selection filtering) do not implement the required custom fields or form plugins integration specified in issue #24. Implement the actual integration code for ACF, Metabox, JetEngine, Fluent Forms, Gravity Forms, and WS Forms as listed in the checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Out of Scope Changes check ❓ Inconclusive The changes appear to be foundational infrastructure (asset loading, location filtering) but lack context showing how they connect to the stated objective of custom fields and form plugins integration. Clarify whether these changes are prerequisites for issue #24 or part of a separate initiative, and provide documentation linking them to the integration requirements.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/24-custom-fields-forms-integration

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

github-actions bot added a commit that referenced this pull request Feb 5, 2026
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

🤖 Pull request artifacts

file commit
pr25-cimo-25-merge.zip 16e6c83

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/admin/js/media-manager/select-files.js`:
- Around line 52-56: The Gravity Forms selector in the event target check inside
select-files.js uses a trailing space (' .gfield--type-fileupload ') so
event.target.closest('.gfield--type-fileupload ') never matches; update the
condition that calls event.target.closest to use the correct selector string
'.gfield--type-fileupload' (remove the trailing space) so Gravity Forms file
upload elements are properly detected while leaving the other closest checks
('.moxie-shim' and '.rwmb-meta-box') unchanged.
🧹 Nitpick comments (1)
src/admin/class-script-loader.php (1)

30-31: Consider conditional loading to avoid unnecessary frontend overhead.

This enqueues assets on every frontend page regardless of whether a Gravity Forms file upload field exists. For sites with many pages, this adds unnecessary script/style overhead.

Consider conditionally loading only when needed, for example by checking if the current page contains a Gravity Form with file upload fields using GFAPI::get_forms() or hooking into gform_enqueue_scripts instead.

♻️ Alternative approach using Gravity Forms hook
 			// Enqueue for the admin area in general.
 			add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_cimo_assets' ] );
-			// Enqueue in frontend for forms plugin
-			add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_cimo_assets' ] );
+			// Enqueue for Gravity Forms frontend file uploads.
+			add_action( 'gform_enqueue_scripts', [ $this, 'enqueue_cimo_assets' ] );

@Arukuen Arukuen changed the title feat: metabox, gravity forms feat: custom fields and form plugins integration Feb 6, 2026
github-actions bot added a commit that referenced this pull request Feb 6, 2026
github-actions bot added a commit that referenced this pull request Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Fields and Form Plugins Integration

1 participant