I’m currently creating a Workspace view (what were previously content apps) that is displayed on content nodes. For the content, I need to have the key of the current (content node). For the life of me, I can’t find what context I need to use to get this id. Anyone can help me?
Hi,
you can use the UMB_DOCUMENT_WORKSPACE_CONTEXT
and then get the unique id.
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, async (context) => {
this.Key = context.getUnique() as string;
});
Just a hint as well, which I learned the other day: in the area you’re working in, you can drop this web component:
<umb-debug visible dialog></umb-debug>
This will pop up something that will show you a long (maybe a bit too long) list of “things” that are available to you there. Looks like that should make it a bit easier to have a chance of finding the context you need.
What module is that in? I would expect it was de workspace module, but it doesn’t appear that that is the case:
import { UMB_DOCUMENT_WORKSPACE_CONTEXT, UmbEntityWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
Can’t find it in the Umbraco UI source…? Code search results · GitHub
in v15.
it’s in @umbraco-cms/backoffice/document
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/document';
Also, the actual umbraco backoffice stuff isn’t in that repo (that is the UI elements only, which is a separate library).
The umbraco code (backoffice and front end) are in this one.
Specifically the front end it in the Umbraco.Web.UI.Client folder
Thanks Kevin, this works! I’m so struggling to find where to look for documentation, examples, the correct source code. For instance, I can’t find just a list of available contexts in Umbraco. The debug element @sebastiaan mentioned might help a little, but the documentation is still a horror. I can’t imagine the issues you had updating uSync to 14 and 15
there is a ‘api’ document site here : @umbraco-cms/backoffice
but to be honest, i have a local copy of the v15 repo loaded up in a copy of vscode, and i search it.
That’s how I learned most of Umbraco back in the day🤘
The other way I learned was looking at the source of other people’s packages
We’re aware that it’s often not obvious where to look for what you need, on the opposite side, it’s also such a flexible system that it’s hard to anticipate what people will need.
I would think the Documentation team is eager to hear what types of articles are missing and what is missing from existing articles to make it easier to tie it all together. Please make good use of the issue tracker so the docs team knows where the biggest pain points are and can work on those.
I’m aware of that It’s just that I don’t have the time at the moment to contribute (and also at the moment I’m not confident enough to contribute yet). I do use the ‘smilies’ next to an article to provide feedback when there are for instance things missing, or dead links. Hope that finds it’s way into the right hands.
But the issue I have is that all articles about extending Umbraco (about workspace, menu, actions etc) seem more like placeholder with a few scribbles than a coherent story about how stuff actually works, let alone what the connection is between different entities.
Contibuting yourself is of course a best case - but raising an issue telling them what you were trying to make, where you looked and why that didn’t help is also really useful to know what to write!
The smileys are helpful to some extent I guess, but hard to tell why someone click an unhappy smiley