-
Notifications
You must be signed in to change notification settings - Fork 638
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
[5.x]: asset.render() gives Error: Call to a member function getHandle() on null #15426
Comments
Search for that error in |
Thanks for looking into this, here is the stack trace:
|
Thanks! Craft 5.2.9 is out now with a fix for that. |
Thanks! |
@brandonkelly Hmm, the PHP error is indeed gone, but now the "Element “[name of the asset]” doesn’t have a field layout provider that defines a handle, so it can’t be rendered with a partial template." error is thrown. I tested this again by setting a profile photo and creating a twig template that only contains the line
|
Sorry, looks like element partial template rendering was just broken for non-entry element types. Just fixed that for the next release. You can grab the fix early by changing your "craftcms/cms": "5.x-dev as 5.2.9", Then run |
Works perfectly now, thanks! |
Craft 5.2.10 is out with that fix. Thanks again! |
What happened?
Description
When tying to call the render() function on an Asset element, an error is thrown
Steps to reproduce
Expected behavior
Asset is rendered using the corosponding partial
Actual behavior
The error "Call to a member function getHandle() on null" is thrown. This is because the provider for the Asset's FieldLayout is
null
Craft CMS version
5.2.8 (upgraded from 4.10.6)
PHP version
8.3
Operating system and version
No response
Database type and version
MariaDB 10.6.18
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: