I can get a list of document types using the contentTypeResource like this:
contentTypeResource.getAll()...
This is great but it only returns the actual document types and not the folders. I.E. I am only getting back MyCoolDoc and MyBetterDoc
I can see that the doctype entities returned have a parentId and this parentId corresponds to where it is sitting in the tree. I can see that the ID's correspond to the folder I want, but at the moment I am having to hardcode my ID in my filter for the folders [eg 1053] as I can't find a good way to query out folder.
Is there another way I can get at this data so I can query for the folder, and then its child entities?
Thats where I started off, but unfortunately the entityResource does not return the folders either. Also, entityResource returns the icon attribute of the document types as null. contentTypeResource returns all the properties.
I think that because the organisation folders are not really document types they probably won't be returnable.
I will just have to put a prevalue setting in somewhere and set the root :-(
I have a use-case for this in the long-term but haven't looked at doing anything about it yet. My one and only thought so far is that there's an instance whereby this already happens in the CMS, so I'd probably start digging in there. If you're editing a document type in the Settings section and you click the 'Composition' link at the top right it opens a side-panel which shows all of your document types in their respective folders.
I had a vague memory Kenn Jacobsen implemented this last year some time and having trawled through his millions of incredible contributions from the past few months I found this: https://github.com/umbraco/Umbraco-CMS/pull/3900.
Get the organisational folders from the documenttype tree in Angular
I'm working on a project where I have a document type picker. My documentTypes are organised in folders eg:
I can get a list of document types using the contentTypeResource like this:
This is great but it only returns the actual document types and not the folders. I.E. I am only getting back MyCoolDoc and MyBetterDoc
I can see that the doctype entities returned have a parentId and this parentId corresponds to where it is sitting in the tree. I can see that the ID's correspond to the folder I want, but at the moment I am having to hardcode my ID in my filter for the folders [eg 1053] as I can't find a good way to query out folder.
Is there another way I can get at this data so I can query for the folder, and then its child entities?
I don't have a ready machine for testing currently, I suggest to test
entityResource
getById
andgetAncestors
functions.Thats where I started off, but unfortunately the entityResource does not return the folders either. Also, entityResource returns the icon attribute of the document types as null. contentTypeResource returns all the properties.
I think that because the organisation folders are not really document types they probably won't be returnable.
I will just have to put a prevalue setting in somewhere and set the root :-(
Might raise an issue to get it looked at.
Hey Peter,
I have a use-case for this in the long-term but haven't looked at doing anything about it yet. My one and only thought so far is that there's an instance whereby this already happens in the CMS, so I'd probably start digging in there. If you're editing a document type in the Settings section and you click the 'Composition' link at the top right it opens a side-panel which shows all of your document types in their respective folders.
I had a vague memory Kenn Jacobsen implemented this last year some time and having trawled through his millions of incredible contributions from the past few months I found this: https://github.com/umbraco/Umbraco-CMS/pull/3900.
Does this help?
is working on a reply...