-
Notifications
You must be signed in to change notification settings - Fork 811
Kinds #7468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Kinds #7468
Conversation
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good to me @bszyman. I made a couple of suggestions you can consider for improvements.
Regarding the one about using UmbExtensionManifestKind, you'll need to verify that, but it is what I see in the source code so even if the syntax you have works, if what I've suggested does too then I think it's better to align with what people might see if they look into the CMS source code.
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
|
Hi @bszyman Looks good, Ive added comments to Andy's comments above, just to confirm his perspectives. I would like to add for a Kind to show up correctly in TypeScript. Especially relevant if your kinds are to be available for others. Then it is important also to define Types for the Kind. For the particular example, it would look like this: This will give Intellisense when writing a Manifest of that Type and Kind. For it to be available for others, as in if you are doing a package, that would be a bigger story, properly requiring some article describing how you need to publish your package on NPM and make an export of the package types. So the above 'Global' types can be declared in the tsconfig for the customizatin using CMS & the fictive package. So similar to how we export extension-types, a package would need to do similar. See TSConfig of this part: https://docs.umbraco.com/umbraco-cms/customizing/development-flow#typescript-setup Using a package that you like to utilize the Types of β would result in a tsconfig looking something like this: I hope that perspective makes sense, so that does invite for a Article on |
|
@nielslyngsoe - Appreciate your suggestions! What I've done in my sample project is added a file
And this is my code, mostly copying what you provided. import type {
ManifestHeaderApp,
MetaHeaderAppButtonKind,
} from "@umbraco-cms/backoffice/extension-registry";
export interface CustomManifestHeaderAppButtonKind extends ManifestHeaderApp {
type: "customHeaderAppButton";
kind: "button";
meta: MetaHeaderAppButtonKind;
}
export interface CustomMetaHeaderAppButtonKind {
href: string;
label: string;
icon: string;
}
declare global {
interface UmbExtensionManifestMap {
CustomManifestHeaderAppButtonKind: CustomManifestHeaderAppButtonKind;
}
}TS doesn't like the
I want to make sure I'm clear/not misunderstanding:
|
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
16/umbraco-cms/customizing/extending-overview/extension-types/kind.md
Outdated
Show resolved
Hide resolved
nielslyngsoe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @bszyman looks good, but the original examples was actualy correct. So now there is a bit of a mismatch, I think its because the context of the original examples was missing.
The fact that the referenced kind: 'button' is a Core kind, that the example uses. :-)
β¦ for consistency, removed outdated warnings, and refined TypeScript integration details.
|
Hi @bszyman `
there you go:
I hope that helps :-) |
|
@nielslyngsoe - Okay, that makes perfect sense! This one has been confusing for me to revisit... it's like, a month or more old at this point and figuring out where we left off with it was challenging. But I see what you're saying now. Fixed up, please give a second look when you have a moment! :) |
| alias: 'Umb.Kind.MyButtonKind', | ||
| matchType: 'headerApp', | ||
| matchKind: 'customHeaderAppButton', | ||
| matchKind: 'button', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry. My bad. Β΄buttonΒ΄ is a core kind. So that cannot be registered as a custom one.
So, yes, in this case, when bringing your own, then customHeaderAppButton is correct. Otherwise, it collides with the Core Kind. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it just feels a little funny that the example brings something that already exists in Core. So that was properly something that confused me a bit


π Description
The original article seemed like it was written by AI maybe? It was mostly correct, just a few changes and clarifications to make.
π Related Issues (if applicable)
#7425
β Contributor Checklist
I've followed the Umbraco Documentation Style Guide and can confirm that:
Product & Version (if relevant)
v16
Deadline (if relevant)
N/A
π Helpful Resources