Anyone has an example of a workspace
# package-development
p
Anyone has an example of a workspace view on a custom workspace? I am trying to copy it from the umbraco source, but I think I am missing something
I double/tripled checked all the namings and I believe they are all correct. I also checked if my entity type: "script" was conflicting with something else but that also wasn't it
And after 2 hours of debugging I am not sure what other options I can still try. I am trying to use the webhooks from the umbraco source code, but I can't really find any difference that would cause it to not work
n
Hi @Patrick de Mooij I would think the problem lies in the fact that your Context is not a Context. Make it extend this base class instead:
extends UmbContextBase
and then use this token for it, when extending the context base, its parsed as the second argument for the constructor:
Copy code
constructor(host: UmbControllerHost) {
    super(host, UMB_WORKSPACE_CONTEXT.toString());`
The reason for this is that the Condition you use for the Workspace View, is consuming the Workspace Context to check for the Entity Type or Workspace Alias — depending on which of the conditions you use. 🙂 I hope that makes sense and helps you moving forward 🙂
p
That indeed did the trick! Thank you. I was just wondering how the UmbControllerBase actually works for this context: https://github.com/patrickdemooij9/SeoToolkit.Umbraco/blob/dev/main/src/SeoToolkit.Umbraco.ScriptManager/assets/src/workspaces/ScriptManagerModuleContext.ts. Is that because it has the .ProvideContext?
n
that is because of this code
Copy code
this.provideContext(ST_SCRIPTMANAGER_MODULE_TOKEN_CONTEXT, this);
this.provideContext(UMB_WORKSPACE_CONTEXT, this);
the difference between a controller and a context, is near to none. a context is a controller that is provided as a context. Which is done by one of the lines above. 🙂
So the Context base, just helps ensure that you actually provide it. 🙂
3 Views