Closed thulstrup closed 5 months ago
Somehow the template mode is ending up as site
, instead of cp
, when trying to render that template.
Following the web of calls, it looks like there’s a suppressed exception somewhere in the view component, which is preventing the View::setTemplateMode
from restoring the correct template mode.
The regression was introduced in 3.3.1.1. A temporary workaround is to downgrade Craft. I had no troubles with project-config when I did so.
Thanks for reporting, I'll get up to the latest version and test as soon as I can
Reverting to 3.3.1.1
worked. Thanks, @nstCactus 🙏
So, just testing on 3.3.1.2, and I can't seem to recreate this issue. I've tested editing/creating Super Table field, editing/creating entries with Super Table fields attached to them, but all seems okay?
I wonder if its another plugin incorrectly settings the templateMode, before Super Table? Would have to be something common to 3 people though!
Here are my plugins:
The error still persists when I disable all of them (except Super Table).
Thanks @thulstrup does this occur when you're editing specific entries, or any entries? When you load an entry, or save it? Does it happen for sections that don't have a Super Table field?
When specifically does it occur?
If anymore can provide a screenshot of the full stack trace with devMode on, I can debug further
@engram-design I don’t think a stack trace is going to help here as the exception surfacing is thrown by the template loader. As noted in craftcms/cms#4912, due to the 3.3.1.2
changes, the Assets field is suppressing any underlying exceptions.
I saw this exception being thrown by an SuperTableBlockElement
instance with only the fieldId
set. Briefly looking at the database, all looks present and correct. Is there any reason why that might have been unpopulated?
@joshuabaker If not for the stack trace then when/where is the error occurring? I can't even get it to throw this error, which is what I'm try to recreate. Basically, after the error page that's showing Twig Template Loading Error – craft\web\twig\TemplateLoaderException Unable to find the template “_components/fieldtypes/Assets/input”
Not 100% sure about the second part to your question, and it depends when it occurred and what you were doing. Was it loading an entry to edit, saving, or something else?
Can you advise on your Super Table field setup maybe?
I'm also not sure I follow about the error suppression within this file. I can uncomment those try/catch statements to throw that error, and even throw an exception further up, and it won't affect things from loading okay
Here’s a breakdown of what I saw yesterday:
inputSources
, the Assets
field instance calls renderObjectTemplate
View
then sets the template mode to ‘site’View
then tries to get variables from SuperTableBlockElement
ownerId
is not set so throws an exception (View
therefore doesn’t get to reset the template mode to ‘cp’)Assets
catches that exception_components/fieldtypes/Assets/input
template in the wrong template modeThanks for the detailed explanation @joshuabaker - was this an existing entry you were editing or a new one? Seems to be an issue with ownerId
not being set, as you've mentioned
Sure thing. It’s a complicated web of calls to traverse.
was this an existing entry you were editing or a new one?
It was an existing entry.
Seems to be an issue with
ownerId
not being set, as you've mentioned
If memory serves, only the fieldId
was set on the SuperTableBlockElement
instance.
I think the issue is actually unrelated to 3.3.1.2
. It’s just that the moving setTemplateMode
call before the element is accessed has allowed this to surface.
Yep, that's what I'm thinking @joshuabaker - its just surfaced the issue. I'll try and investigate further, but might likely need access to one of these installs to see specifically what's going on.
Thanks for your troubleshooting!
@engram-design I can load existing entries, but I can't edit or create new. It only happens for entries with Super Table fields.
Here's a stack trace: https://pastebin.com/c5PMG1WY
Description
After updating Craft I'm unable to create or edit any content in the admin interface.
Craft throws an error: Twig Template Loading Error – craft\web\twig\TemplateLoaderException Unable to find the template “_components/fieldtypes/Assets/input” at line 27 of vendor/verbb/super-table/src/templates/field.html
Additional info