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
Switch to first allowed type if default type is not allowed in element group #7196
base: 5.3
Are you sure you want to change the base?
Conversation
I wonder why PHPStan gives an error. According to PHPStan, I am using the User class here, although I am using the BackendUser class. Can this be ignored or do I have to adjust something here? It has no problems with BackendUser in tl_content.php. |
Thanks for the follow-up @dennisbohn! I have two issues here:
|
What do you mean? The pull request adds a listener, not a voter. |
I mean that my content-element access voter would fix this as well, but it would vote on the allowed nested elements. |
Ah, that‘s a tricky one. There is a user setting for allowed content elements, which per our definition is the responsibility of the security voters. But there is also the However, since both |
I don’t agree. For me the security voter should only handle the |
If you think what an admin would experience, it's clear that the |
You are absolutely right. |
Unfortunately, I broke my last pull request. So here is the second attempt.
Currently, the type field of a content element is set to "article" by default, which leads to an unknown option being displayed in the drop-down list of the type if you create it in an element group where the type "article" is not contained in "allowedTypes".
In this case, the added callback function automatically changes the value to the first supported type.
Furthermore the tl_content.php was modified to close the content element, if the user has no permission for the nested elements.