-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Null Variable Supertable inside Matrix Supertable v2.6.5 #399
Comments
I have the exact same problem.
|
I'm experiencing the same issue. A SuperTable field inside a Matrix field returns I can report that rolling back to 2.6.4 resolves the issue (though there may be side-effects in doing that, since 2.6.5 looks like a bugfix release). Plugin version: 2.6.5 |
Looks like #395 may be related to this issue as well. |
Any fix on this yet? Content in these blocks disappeared after updating everything... |
I can't replicate this behaviour. If this seems to be an issue in 2.6.5, it must be something to do with static field. No one has mentioned if their setups are using a static field - can anyone confirm? In addition @williamhibberd your screenshot of your field setup does cut off some of the more crucial things such as what the inner field types are. If someone here uses Field Manager, it'd be great to get an export of the field they're using so I can try to replicate on my end. |
I use field manager on one of my sites that have this issue. I have attached export from field manager of 3 different fields that experience this issue:
In all 3 cases, I can fix this issue by first grabbing one or all supertable blocks, where before the query defaulted to grabbing the first one even if not explicitly specified in the code. For example with the "Banner" field, the error occurs with this code: I guess my biggest issue here is that it happened with a patch release. Hope this helps. Please let me know if you'd like any more info. |
@engram-design I also use Field Manager. I've attached the export of the field below, although it's a Matrix content builder field and therefore quite large and complex. The |
Hi @engram-design, please see attached my matrix field export from the issue. |
@i-just Thanks for your field setup, that's very helpful. So for starters, accessing Super Table fields like that:
Should only work if you're dealing with a static Super Table field. You might not believe it, but I didn't even realise your way was possible, as I've never used that syntax, tested for it or documented it. It was never intended to work that way, and in hindsight, providing a shorthand way to access static Super Table blocks is the reason we're in this mess, and it's a hacky solution. Instead, you should be treating a Super Table field as a collection:
Similarly for your second template code:
It should be:
Because there's not supposed to be direct access to the first bock when calling I would say this is the same scenario as @martyspain and @williamhibberd and @mateostabio so clearly people are using that syntax As for it being in a patch release, it was to address an extremely urgent issue that could crash the entire control panel, due to a change made in Craft 3.5.17+, when dealing with Super Table fields. So while its regrettable this has caused other issues, I stand by it. For now, I would say everyone can fix this by updating their templates to reflect correct behaviour using either Please chime in if the above doesn't cover your issue. |
@martyspain A word of warning if you downgrade, you'll likely hit the attached error (or similar) when saving an element that contains a Super Table field. Note you'll need to change some content in your Super Table blocks for a save to be triggered if you're testing yourself. |
…field, which would otherwise return null Please see #399 (comment) in that you shouldn’t be doing this anyway, like `entry.superTableField.myField` is reserved for static fields.
For anyone unable to update their template code, I've just fixed this by implementing Craft 3.5.16's functionality in 2.6.6, which should restore the behaviour you're used to and fix this issue. |
Thanks @engram-design. I haven't had a look at the documentation in a while, but I think I know how that example code ended up the way it is. Anyway, I do agree that it's not the best bit of code and I will be changing it. Thanks for looking into this! |
Description
Everything working fine in 2.6.4 but when I update to 2.6.5 I am getting:
Impossible to access an attribute ("value") on a null variable.
With a supertable inside a matrix field.
Matrix setup:
Matrix block templating
Additional info
The text was updated successfully, but these errors were encountered: