[5.x]: ElementHelper::isDraft
not working for nested elements
#15303
Labels
ElementHelper::isDraft
not working for nested elements
#15303
What happened?
When a nested entry in a matrix field is modified, a draft is automatically created. When the draft is saved, however, calling
ElementHelper::isDraft($element)
returnsfalse
.This appears to be caused due to
getIsDraft()
being called on the root element, rather than on the element itself.cms/src/helpers/ElementHelper.php
Line 490 in 37356eb
I imagine this could be solved as follows:
Note that the
ElementHelper::isDraftOrRevision()
and possibly also theElementHelper::isRevision()
method should be updated accordingly.Steps to reproduce
ElementHelper::isDraft($element)
.Expected behavior
ElementHelper::isDraft($element)
should returntrue
.Actual behavior
ElementHelper::isDraft($element)
returnsfalse
.Craft CMS version
5.2.5
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered: