Identifying what Document Type something is
# help-with-umbraco
j
From the backoffice how can I work out whether a document type is a Document Type, an Element or a Composition?
a
Well you can know if its a Document Type and not an Element/Composition by going to the permissions tab and see if the 'is an element type' is permanently disabled
I believe an Element/Composition are fairly interchangeable, you can ofcourse check the Compositions buttons to see if its used anywhere...
but theres no spot anywhere that says "Im a document type/element/composition' no
j
OK so there's a set of "If this then that" deduction but no explicit definition?
My last issue is when an Element can be used instead of a Composition - I can inherit either in the Compositions menu... so I, very new to Umbraco, am lost as to when I can use an Element and can't use a Composition, and visa versa.
m
or you could use GodMode DocType Browser.. filter by element type.. prob backwards from what you require.
To add to your flow.. element could have a composition.. but composition can't.
you also get if a composition is used.. then the compostions content app on that composition doctype gives you ..
And just to complicate things you can have inheritance in doctypes too..
j
Thank you Mike, I'll work through these and get back to you, ty!
(For reference I'm trying to achieve this without God Mode, though of course In God Mode We Trust)
a
A composition is not necessarily an element type. It is if you select to create a new element through the UI, so in most cases a composition will probably be an element type as well. If you're using Models Builder, a composition that is also an element type will implement the
IPublishedElement
interface, whereas a composition that is not an element type will implement the
IPublishedContent
interface. In some cases that could matter.
j
If I'm understanding this correctly, even if I'm using an Element I am still told "Where is this composition used?", not "Where is this element used?".
I have found that Elements can have Elements and Compositions, and Compositions can have Elements and Compositions. Apologies if I've misunderstood:
m
When you say a composition can have compositions.. have you actually used that composition in a doctypes compositions elsewhere? As otherwise it's still just an element.. AFAIK elements become compositions when they are used as a composition otherwise they are still just elements. 🤔
j
I'll test out the first part of your message shortly, but to the second - there's actually a point where an element becomes a composition? Is this documented anywhere? My initial point is just "If I create>Element Type or create>Composition" how can I check what I've created, outside of its initial icon. I'm fascinated with how complicated this appears to be! Hugely appreciate the insight.
m
I think this menu grew organically out of a previous you either created a Doctype or a folder, and then had to set the options yourself.. so it's simply an abstraction over that. So DT, ET, COMP are really just all documentTypes.. with options 🙂 I'm not sure it's documented anywhere and that's the reason when you go to add a composition to any of these you get a full list of doctypes not just the so called created as composition. and it's only when you select something that you get a JIT calculated this doctype is checked as element and has been used as a compostion somehwere so don't let it be used as anything else now.. you might be able to read the code?
j
Wow, ok! I'll look into that and review later, thank you for the info!
m
eg there is nothing stopping you going in and altering what was created as a compostion and returning it to a full blown doctype.. (might be some checking and a warning that it has been used as a composition)
j
The Lineage
9 Views