-
Notifications
You must be signed in to change notification settings - Fork 92
gw-advanced-merge-tags.php: Added support for base64 field merge tag modifier.
#1190
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
|
Caution Review failedThe pull request is closed. WalkthroughAdds a new "base64" field modifier that returns Base64-encoded field values and relaxes modifier-name parsing to allow digits in modifier names (letters, digits, and underscores accepted). Changes
Sequence Diagram(s)sequenceDiagram
participant Template as Template / Merge Tag
participant Parser as parse_modifiers()
participant Handler as handle_field_modifiers()
participant Field as Field Value
Template->>Parser: provide merge tag with modifiers
Parser-->>Handler: parsed modifiers list (e.g., ["base64"])
Handler->>Field: request raw field value
Field-->>Handler: returns raw value
alt modifier == "base64"
Handler->>Handler: apply base64_encode(raw value)
Handler-->>Template: return base64-encoded value
else other/none
Handler-->>Template: return processed or raw value
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
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. Comment |
|
base64 field merge tag modifier.gw-advanced-merge-tags.php: Added support for base64 field merge tag modifier.
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: 1
🧹 Nitpick comments (1)
gravity-forms/gw-advanced-merge-tags.php (1)
5-21: Consider documenting the new base64 modifier.The file header documents other supported features and modifiers. Adding the base64 modifier to this list would improve discoverability and maintain consistency with existing documentation patterns.
Example addition:
* + HTML fields * {HTML:3} * {all_fields:allowHtmlFields} + * + base64 modifier + * {Field:1:base64} *
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gravity-forms/gw-advanced-merge-tags.php(2 hunks)
🔇 Additional comments (1)
gravity-forms/gw-advanced-merge-tags.php (1)
533-533: LGTM! Regex change correctly enables digit support.The addition of
0-9to the character class is necessary for parsing modifier names containing digits, such as 'base64'. Without this change, the parser would fail to recognize the new modifier.
| case 'base64': | ||
| return base64_encode( $value ); | ||
| break; |
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.
Remove unreachable break statement.
The break on line 517 is unreachable since line 516 returns. This is consistent with other cases in this switch statement (e.g., lines 467, 469, 471) that return without a subsequent break.
Apply this diff:
case 'base64':
return base64_encode( $value );
- break;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| case 'base64': | |
| return base64_encode( $value ); | |
| break; | |
| case 'base64': | |
| return base64_encode( $value ); |
🤖 Prompt for AI Agents
In gravity-forms/gw-advanced-merge-tags.php around lines 515 to 517, remove the
unreachable `break;` after the `return base64_encode( $value );` in the 'base64'
switch case — simply delete the `break;` line so the case mirrors other
return-only cases and avoids dead code.
Context
⛑️ Ticket(s): https://secure.helpscout.net/link/to/conversation
Summary
Added support for a
base64field modifier.