Skip to content

UFM: Add umbElementName component - #23162

Merged
AndyButland merged 5 commits into
mainfrom
v18/feature/ufm-element-name
Jun 19, 2026
Merged

UFM: Add umbElementName component#23162
AndyButland merged 5 commits into
mainfrom
v18/feature/ufm-element-name

Conversation

@leekelleher

Copy link
Copy Markdown
Member

Adds a new umbElementName UFM component for use in label and description markdown within the backoffice.

Usage: {umbElementName:<element-key>}

This mirrors the existing umbContentName component 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 UmbElementItemDataResolver from the public @umbraco-cms/backoffice/element entry point.

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.
@leekelleher leekelleher changed the title UFM: Add umbElementName component UFM: Add umbElementName component Jun 18, 2026
@leekelleher
leekelleher marked this pull request as ready for review June 18, 2026 12:18
Copilot AI review requested due to automatic review settings June 18, 2026 12:18
@claude

This comment was marked as resolved.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ElementName UFM 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 using UmbElementItemRepository + UmbElementItemDataResolver.
  • Re-exports UmbElementItemDataResolver from @umbraco-cms/backoffice/element (via packages/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.

@AndyButland AndyButland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Image

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.

@AndyButland AndyButland added the status/needs-docs Requires new or updated documentation label Jun 18, 2026
@leekelleher

Copy link
Copy Markdown
Member Author

Added in 2f64301 — two cases added to marked-ufm.test.ts ({umbElementName:elementPicker} and { umbElementName: elementPicker }), with the component registered in the test configuration.

@AndyButland
AndyButland enabled auto-merge (squash) June 19, 2026 11:37
# Conflicts:
#	src/Umbraco.Web.UI.Client/src/packages/ufm/plugins/marked-ufm.test.ts
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
22.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants