Wrap component in entity template for contextual links

Created on 5 March 2024, 3 months ago
Updated 20 March 2024, 3 months ago

Problem/Motivation

When an entity display mode is rendered with SDC Display, it doesn't show contextual edit links, which are placed in the entity template.

Before I used SDC Display, I was including or embedding components in my node/block templates. This let me place the title_prefix inside the wrapper to show contextual links.

I could either print the wrapper and links inside the main template, or move those into the component and pass in title_prefix and attributes.

One strategy to do this with SDC display is to add a field group, move your fields into it, and render that as your component.

Another is to set up your display with sdc, then use another display with layout builder and place the rendered entity block using the sdc display.

Either way, you don't get as much control over the output without modifying the template. I am looking for a way to get more configuration options for the wrapper.

I am thinking that I could create a component for the entity templates (basically a copy of the node/block template file) that would be selectable as the wrapper, in addition to the SDC component selection. The wrapper component could have additional props for things like classes or variants, and slots to place the whole rendered SDC component, or field grouped components. This paradigm is not far off from using a layout, and that would also benefit from being able to adjust the entity template.

Another way to go would be to populate the contextual edit links as a pseudo field that could be placed within the component, or an option in the component settings to include them.

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024