-
Notifications
You must be signed in to change notification settings - Fork 92
gppa-wpml-current-language-choices.php: Automatically filter posts by current WPML language.
#1192
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
…by current WPML language.
|
Caution Review failedThe pull request is closed. WalkthroughIntroduces a new PHP filter for Gravity Forms Populate Anything that restricts input choices to those matching the current WPML language when a field has the CSS class Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
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 |
|
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gp-populate-anything/gppa-wpml-current-language-choices.php(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-05-30T13:53:21.893Z
Learnt from: veryspry
Repo: gravitywiz/snippet-library PR: 1077
File: gravity-forms/gw-require-alt-text-description-post-image.php:23-32
Timestamp: 2025-05-30T13:53:21.893Z
Learning: In Gravity Forms snippets, use 'gravityforms' as the translation domain for internationalization functions instead of creating custom domains, to maintain consistency with the related plugin.
Applied to files:
gp-populate-anything/gppa-wpml-current-language-choices.php
🪛 GitHub Actions: PHP Lint (PR)
gp-populate-anything/gppa-wpml-current-language-choices.php
[error] 36-36: PHPCS: Short array syntax is not allowed. Generic.Arrays.DisallowShortArraySyntax.Found.
🪛 GitHub Check: PHPCS (Files Changed)
gp-populate-anything/gppa-wpml-current-language-choices.php
[failure] 67-67:
Short array syntax is not allowed
[failure] 36-36:
Short array syntax is not allowed
🪛 PHPMD (2.15.0)
gp-populate-anything/gppa-wpml-current-language-choices.php
18-18: Avoid unused parameters such as '$field_values'. (undefined)
(UnusedFormalParameter)
🔇 Additional comments (6)
gp-populate-anything/gppa-wpml-current-language-choices.php (6)
1-15: Clear documentation and instructions.The header documentation clearly explains the snippet's purpose and provides actionable setup instructions for users.
16-16: Hook registration looks correct.The filter is properly registered with the appropriate callback, priority, and parameter count.
18-22: Good defensive check for WPML availability.The early return when WPML is not active prevents errors. The unused
$field_valuesparameter flagged by PHPMD is acceptable since it's part of the hook signature.
24-28: Correct CSS class detection with proper early return.The use of
strposwith strict comparison=== falsecorrectly handles all edge cases for string position checking.
30-34: Proper WPML language detection with safety check.Using the
wpml_current_languagefilter is the correct approach, and the early return handles cases where language detection might fail.
83-83: Clean return of filtered results.The function correctly returns the filtered choices array.
…by current WPML language.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/3146079791/93861
Summary
This is a user submitted snippet by Dennis Hunink. The snippet automatically filters posts by the current WPML language.