fix: add support for multilingual content#30
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant ContentUtility
participant Database
Caller->>ContentUtility: fetchContentElements(pid, languageUid, includeMultilingualContent)
ContentUtility->>Database: Build query (hidden=0, deleted=0, pid=pid)
alt includeMultilingualContent = true
ContentUtility->>Database: Add sys_language_uid IN (-1, languageUid)
else includeMultilingualContent = false
ContentUtility->>Database: Add sys_language_uid = languageUid
end
Database-->>ContentUtility: Return content elements
ContentUtility-->>Caller: Return array of content elements
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ 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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Classes/Utility/ContentUtility.php (1)
41-41: Consider adding method chaining documentation.The change from a chained method call to using the stored query variable is fine. For even better readability, you might consider adding a brief comment explaining the conditional filtering behavior for future maintainers.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Classes/Utility/ContentUtility.php(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: SCA
🔇 Additional comments (3)
Classes/Utility/ContentUtility.php (3)
15-15: Backward-compatible method signature update - LGTM.The addition of the optional
$includeMultilingualContentparameter with a default value oftruemaintains backward compatibility while adding new functionality.
19-26: Good separation of query conditions.I like how you've separated the base conditions from the language-specific filtering. This makes the query construction clearer and more modular.
28-39: Well-structured language filtering logic.The conditional language filtering is clearly implemented:
- When
$includeMultilingualContentis true, both language-neutral content (sys_language_uid = -1) and language-specific content are included- When false, only the specific language content is included
This implementation properly supports the PR objective of adding multilingual content support.
Fixes #28
Summary by CodeRabbit
New Features
Refactor