-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(hooks): trigger hooks on product index and product show #18191
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 Twig variable named Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (3)
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 (
|
❌ Preview Environment deleted from BunnyshellAvailable commands:
|
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 (2)
src/Sylius/Bundle/ShopBundle/templates/product/index.html.twig (1)
3-3: DRY the hook prefix to prevent string driftThe literal
'sylius_shop.product.index'now occurs twice (here and in the{% hook %}call below). If this identifier ever changes, it must be updated in two places, increasing maintenance overhead and the risk of subtle bugs.-{% set prefixes = ['sylius_shop.product.index'] %} +{% set _hookPrefix = 'sylius_shop.product.index' %} +{% set prefixes = [_hookPrefix] %}Then replace the hard-coded string in the hook call:
- {% hook 'sylius_shop.product.index' with { products, resources } %} + {% hook _hookPrefix with { products, resources } %}src/Sylius/Bundle/ShopBundle/templates/product/show.html.twig (1)
3-3: Apply the same single-source-of-truth pattern as in the index templateFor consistency and maintainability, consider introducing a dedicated variable for the hook name and reusing it in the
{% hook %}invocation.-{% set prefixes = ['sylius_shop.product.show'] %} +{% set _hookPrefix = 'sylius_shop.product.show' %} +{% set prefixes = [_hookPrefix] %}And below:
- {% hook 'sylius_shop.product.show' with { product, configuration } %} + {% hook _hookPrefix with { product, configuration } %}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/Sylius/Bundle/ShopBundle/templates/product/index.html.twig(1 hunks)src/Sylius/Bundle/ShopBundle/templates/product/show.html.twig(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Static checks / PHP 8.3, Symfony ^7.2
- GitHub Check: Static checks / PHP 8.4, Symfony ^7.2
- GitHub Check: Static checks / PHP 8.2, Symfony ^6.4
1281070 to
d3777a1
Compare
GSadee
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.
I’ve tested this once again and compared it with my proposal from the review. I’m fine with this change, as it properly differentiates the product show and index pages and, as a result, allows us to define things like different meta tags for each of them.
d3777a1 to
6d0ceac
Compare
To trigger some hooks like
sylius_shop.product.index#metatagsandsylius_shop.product.show#metatagsSummary by CodeRabbit