I'm attempting to pass data from the CMS via a {{ collection }} loop through a child partial to the origin's grandchild partial. This is because I have a base card partial that I've extended with modified card partials like _card_featured
I think this is a bug based on my testing. I've tried a bunch of different solutions including different syntax, raw modifier and scoping the passed data.
Parent HTML:
```{{ collection:blog_posts }}
{{ partial:blog_posts/card_featured
:p_background_color="background_color"
:p_title="card:title"
}}
{{ /collection:blog_posts }}
`blog_posts/card_featured` partial:
{{ partial:components/card classes="bg-gradient-to-br from-{p_background_color} to-{p_background_color}-900
text-white" }}
{{ /partial:components/card }}
`_card.antlers.html` (base card):
## How to Reproduce
I have replicated the issue in a new clean Statamic V3 repo and stripped out all unnecessary things.
1. Clone this repo: https://github.com/austriker27/statamic-partial-grandchild
2. Inspect the centered `<a>` tag on the page and you will see the gradient classes have `NULL` in them. However when you ` {{ dump }}` you will see the data is correct there.
Rendered HTML:
YAML file with the background_color data
Statamic 3.0.19 Solo
Laravel 8.10.0
PHP 7.4.8
No addons installed
Install method (choose one):
statamic/statamicThanks gents! Statamic is the best thing ever and I appreciate you.
Alright, after I bit of playing around, I think I figured out the issue.
In the _card_featured partial, when you are calling the other partial, it's split into two lines, this bit below...
{{ partial:components/card classes="bg-gradient-to-br from-{p_background_color} to-{p_background_color}-900
text-white" }}
If you were to put it into a single line like so, it starts working... as if by magic.
{{ partial:components/card classes="bg-gradient-to-br from-{p_background_color} to-{p_background_color}-900 text-white" }}
Hopefully that solves the problem for you. Thanks for creating the demo repo, super helpful!
I'm keeping this issue open because fixing parameter values being split into multiple lines might be a bug that should be fixed.
Whoa, now that is very interesting. I swear I tried to fix that line break (which was from my prettier/eslint/edtior config I think) and it still didnt work. Thanks for digging in @damcclean, I'll try that on my repo and let you know.
Follow up: I can confirm fixing the line break fixed my particular issue! Thanks so much Duncan! I'm actually happy it was just an error in my code rather than error in the gentlemen's code. 😀
Should I close this? Or if its left open, rename it?
Just keep it open until the gents confirm if it's something that should be fixed or not.
Yeah line breaks like that shouldn't affect it. This is a bug.
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.
Hey bot, please keep it open.