-
Notifications
You must be signed in to change notification settings - Fork 92
gw-merge-tag-modifier-remove-spaces.php: Added new snippet.
#1076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new PHP snippet has been introduced to add a custom merge tag modifier called Changes
Sequence Diagram(s)sequenceDiagram
participant GravityForms
participant MergeTagModifier
GravityForms->>MergeTagModifier: Process merge tag with modifier
alt Modifier is "remove_spaces" and value is not blank
MergeTagModifier->>MergeTagModifier: Remove all spaces from value
MergeTagModifier-->>GravityForms: Return modified value
else Modifier is not "remove_spaces" or value is blank
MergeTagModifier-->>GravityForms: Return original value
end
Possibly related PRs
Suggested reviewers
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
gravity-forms/gw-merge-tag-modifier-remove-spaces.php (1)
12-18: LGTM! Implementation is correct and clear.The snippet correctly implements the
remove_spacesmodifier for Gravity Forms merge tags. The logic is sound, and the code is concise and readable.Optionally, for broader applicability, consider supporting removal of all whitespace (tabs, newlines, etc.) using a regular expression:
- return str_replace( ' ', '', $value ); + return preg_replace( '/\s+/', '', $value );If you intend to only remove space characters, the current implementation is perfect. If you want to clarify this, you could add a note in the docblock.
saifsultanc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! S&M please!
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2909059270/82229?viewId=14960
Summary
Adds a merge tag modifier to remove spaces from a value.