Skip to content
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

[FEATURE] Set an "Allowed Parents" property on Data Object classes #5138

Open
ssimo3lsuhsc opened this issue Oct 23, 2019 · 0 comments

Comments

@ssimo3lsuhsc
Copy link

@ssimo3lsuhsc ssimo3lsuhsc commented Oct 23, 2019

Feature Request

Feature description

Pimcore already has the feature in its Relation fields to limit the related items to one class. But parent/child relationship in the list/tree is also in and of itself a many-to-one relationship, and it is explicitly implemented as such in the database, via a column named "o_parentid." Given this, it is hard to see why I cannot a restriction on where I instantiate a class in the list/tree. I thought that the "ListParent" property in the class's General Settings served that purpose. I was originally going to propose a One-to-Many relationship field that is the inverse of a Many-to-One relationship, the same way the Reverse Many-to-Many field is implemented. But seeing now that, unlike in SilverStripe, every DataObject in Pimcore has to find its way into the document tree, I believe it suits me better to leverage the parent-child relationship for this purpose.

What I am proposing is this: An "Allowed Classes for Parent Objects" field in General Settings of a class that works the same way as the Allowed Classes field does for relation-type fields, except that the items "Home" and "Folder" would also be included in the list, representing respectively the class of the Home node (most likely some abstract class or singleton) and the class that Folder nodes represent. I get confused myself when looking at code by others and have no clue where to look myself when gleaning that information; I'm just a newbie at Pimcore. The outcome of such a field would be that, when right-clicking a node to add a new item, any classes that have excluded the targeted node's class from their list of allowed parent classes would be absent from the menu. If all of a parent item's children are all absent from the menu, the parent would also be absent.

I would also recommend considering an Allowed Classes for Children option, but it seems that at this point Pimcore is more equipped to handle the requirements of Allowed Parents because it could inherit some of the code from other functions it does handle. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.