Skip to content

Conversation

@sapayth
Copy link
Member

@sapayth sapayth commented Dec 29, 2025

related PRO PR: #260

  • Added new WordPress filter hooks in wedocs core plugin:
    • wedocs_general_settings_fields - for injecting fields into General Settings
    • wedocs_ai_settings_fields - for injecting fields into AI Settings

Summary by CodeRabbit

  • New Features

    • Added extensibility to AI and General Settings panels, allowing third-party plugins to inject additional settings fields without modifying core code.
  • Documentation

    • Added documentation header to GeneralSettings component.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 29, 2025

Walkthrough

Two settings components now support WordPress filter hooks for external field injection. AiSettings.js and GeneralSettings.js each add wp.hooks.applyFilters calls, enabling customization of their respective panels via wedocs_ai_settings_fields and wedocs_general_settings_fields filters, passing relevant settings data as arguments.

Changes

Cohort / File(s) Summary
Settings Components Enhancement
src/components/Settings/AiSettings.js, src/components/Settings/GeneralSettings.js
Added WordPress filter hook injection points (applyFilters) to both settings components to allow external customization of panel fields without modifying core component logic. AiSettings uses wedocs_ai_settings_fields filter, GeneralSettings uses wedocs_general_settings_fields filter. Both pass settings data and setters as arguments for external field rendering.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Two settings now hop with hooks so fine,
External fields can intertwine,
No core logic bent or swayed,
Just filters for customization parade! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'enhance: organize turnstile settings' does not align with the actual changes, which introduce WordPress filter hooks for injecting fields into General and AI Settings panels, not turnstile settings organization. Revise the title to reflect the main change, such as 'enhance: add WordPress filter hooks for settings field injection' or 'add hooks for extending General and AI Settings panels'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 05da333 and 1c95512.

📒 Files selected for processing (2)
  • src/components/Settings/AiSettings.js
  • src/components/Settings/GeneralSettings.js
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/Settings/GeneralSettings.js (2)
src/blocks/DocsGrid/edit.js (1)
  • wp (16-16)
src/components/ProPreviews/LayoutSettings.js (1)
  • settingsData (9-9)
🔇 Additional comments (4)
src/components/Settings/GeneralSettings.js (2)

1-15: Excellent documentation for the new filter hook.

The JSDoc header clearly documents the component's purpose and the new wedocs_general_settings_fields filter, including parameter descriptions and expected return type. This will help developers implementing extensions understand how to inject custom fields.


381-389: Hook implementation is correct; wp.hooks is guaranteed available in WordPress admin.

The filter hook invocation at lines 383-389 follows the WordPress pattern correctly and passes the appropriate context to allow extensions to inject fields. The placement at the end of the settings grid is ideal for appending additional fields.

The wp.hooks global is provided by WordPress core in the admin environment and is properly handled by the @wordpress/scripts build tooling. Since this component is only enqueued in the admin context, wp.hooks will always be available without requiring error handling or verification.

src/components/Settings/AiSettings.js (2)

17-22: Well-documented filter addition with consistent formatting.

The documentation for the new wedocs_ai_settings_fields filter follows the same clear pattern as existing filters in this file and matches the style used in GeneralSettings.js, maintaining consistency across the codebase.


567-575: Consistent implementation across settings panels.

The hook invocation mirrors the implementation in GeneralSettings.js perfectly, maintaining consistency in how external field injection works across different settings panels. The parameters correctly match the documented interface, providing extensions with the necessary context to inject custom fields.


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants