Add ability to get/set IDs

Created on 28 January 2021, almost 4 years ago
Updated 26 April 2024, 7 months ago

Problem/Motivation

Although we can add IDs via "X wrapper attributes (YAML)" via id: testing-1-2-3, it would be really handy to add a dedicated field that could be provided to users which would could provide "friendly ids" in a way that is easy for them to understand.

Use cases:

  • Anchor links to parts of content
  • In-page navigation
  • JS selector

See also:
https://www.drupal.org/project/layout_builder_component_attributes

Steps to reproduce

There is currently no UI to add IDs.

Proposed resolution

Add the ability to add ids.

Remaining tasks

Write code - Touch points include:

Adjust the layout plugin to get/set the id
src/Plugin/Layout/BootstrapLayout.php

If not set, perhaps an autogenerated default is assigned?

Consider whether or not to attempt to enforce unique ids.

User interface changes

Add a fields to enter ids.

API changes

N/A?

Data model changes

Schema changes?

Original report


Original Request by suldan
I could really use an ID on the row element.

The ID could be generated by user input (as for classes) or random hash.

Use cases:

  • In-page navigation
  • JS selector

Greetings
suldan

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇨🇭Switzerland suldan

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024