Skip to content

Conversation

@omarkasem
Copy link
Collaborator

@omarkasem omarkasem commented Jan 14, 2026

This update introduces a new filter, gravityview/fields/custom/replace_variables, allowing plugins to modify the behavior of merge tag replacements in custom content. The filter enables developers to prevent merge tags from being replaced before shortcode processing, enhancing flexibility for plugin integrations.

  • Added filter to control merge tag replacement in field-custom.php
  • Updated logic to conditionally replace variables based on the filter's return value

Summary by CodeRabbit

  • New Features
    • Added a configurable filter that lets developers enable or disable automatic merge-tag and variable replacement in custom content fields. Default behavior remains unchanged (replacement on), but replacement can be skipped when desired to support advanced customization and alternative rendering approaches.

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

💾 Build file (7140471).

This update introduces a new filter, `gravityview/fields/custom/replace_variables`, allowing plugins to modify the behavior of merge tag replacements in custom content. The filter enables developers to prevent merge tags from being replaced before shortcode processing, enhancing flexibility for plugin integrations.

- Added filter to control merge tag replacement in `field-custom.php`
- Updated logic to conditionally replace variables based on the filter's return value
@linear
Copy link

linear bot commented Jan 14, 2026

@omarkasem omarkasem self-assigned this Jan 14, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

Walkthrough

A new filter hook gravityview/fields/custom/replace_variables was added to the custom field template to let callers enable/disable merge-tag/variable replacement. The call to GravityView_API::replace_variables() is now executed only if the filter returns true (default).

Changes

Cohort / File(s) Summary
Custom Field Filter Hook
templates/fields/field-custom.php
Added gravityview/fields/custom/replace_variables filter; introduced $should_replace_variables = apply_filters(..., true) and made GravityView_API::replace_variables() conditional on that flag. Added docblock for the filter and its parameters.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a filter to control merge tag replacement in the custom content field, which aligns with the file modifications in templates/fields/field-custom.php.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 issue/3-gravitymath-form-scope-ignored-in-gravityview

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants