Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
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!