UFM: Add umbElementName component - #23162
Conversation
Adds a new UFM component that resolves Element display names from element keys, mirroring the umbContentName component pattern. Uses the variant-aware UmbElementItemDataResolver (via UmbElementItemRepository) for proper culture/variant handling and (Untitled) fallback. Also exports UmbElementItemDataResolver from the public @umbraco-cms/backoffice/element entry point, matching the pattern used by the documents package.
umbElementName component
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Pull request overview
Adds a new UFM component (umbElementName) to render Element entity names in backoffice markdown (labels/descriptions), mirroring the existing umbContentName flow, and exposes UmbElementItemDataResolver via the public @umbraco-cms/backoffice/element entry point.
Changes:
- Registers a new
Umb.Markdown.ElementNameUFM component (meta.alias: umbElementName) and wires it into the UFM component manifest list. - Implements
<ufm-element-name>to resolve one or more element uniques into display names usingUmbElementItemRepository+UmbElementItemDataResolver. - Re-exports
UmbElementItemDataResolverfrom@umbraco-cms/backoffice/element(viapackages/elements/item/index.ts).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/ufm/components/manifests.ts | Adds the new element-name component manifests into the UFM component registry. |
| src/Umbraco.Web.UI.Client/src/packages/ufm/components/element-name/manifests.ts | Declares the new umbElementName UFM component manifest. |
| src/Umbraco.Web.UI.Client/src/packages/ufm/components/element-name/element-name.element.ts | Implements the resolver element that fetches element item names from uniques. |
| src/Umbraco.Web.UI.Client/src/packages/ufm/components/element-name/element-name.component.ts | Adds the UFM component renderer that outputs <ufm-element-name ...>. |
| src/Umbraco.Web.UI.Client/src/packages/elements/item/index.ts | Re-exports the element item data resolver from the public element package barrel. |
…ment Clear this.value when the render context produces no usable input, preventing stale names from lingering when the context changes. Also destroy each UmbElementItemDataResolver after getName() to avoid accumulating controller registrations on the host element.
There was a problem hiding this comment.
This works as expected @leekelleher - I've wired it up like this using a block list with an element picker, and see the expected result.
One question on testing - looks like we have marked-ufm.test.ts used to test various components, including umbContentName. Should a test for this be added there too?
Then one nit-pick comment inline.
I added the "needs docs" label as this component should be documented here.
…name/element-name.element.ts Co-authored-by: Andy Butland <abutland73@gmail.com>
|
Added in 2f64301 — two cases added to |
# Conflicts: # src/Umbraco.Web.UI.Client/src/packages/ufm/plugins/marked-ufm.test.ts
|


Adds a new
umbElementNameUFM component for use in label and description markdown within the backoffice.Usage:
{umbElementName:<element-key>}This mirrors the existing
umbContentNamecomponent but targets Element entities — useful for property editors and UI that reference block editor elements by key. Supports single keys and arrays, comma-joins multiple names, and handles culture variants with a fallback to(Untitled).Also exposes
UmbElementItemDataResolverfrom the public@umbraco-cms/backoffice/elemententry point.