Add description and previewed_with to options

Created on 3 November 2022, about 2 years ago
Updated 18 January 2023, almost 2 years ago

Problem/Motivation

Today, options are simple "class name" => label dictionaries.

Exemple:

theme_bg_color:
  label: Background color
  options:
    mdc-theme--primary-bg: Primary.
    mdc-theme--secondary-bg: Secondary
    mdc-theme--surface: Surface
    mdc-theme--background: Background

In some cases, we need to add extra informations like description or specific previewed_with:

theme_bg_color:
  label: Background color
  options:
    mdc-theme--primary-bg: 
      label: Primary
      description: Lrem ipsum
      previewed_with: mdc-theme--mdc-theme--on-primary
    mdc-theme--secondary-bg: Secondary
    mdc-theme--surface: Surface
    mdc-theme--background: Background

Remaining tasks

Let's implement this.

User interface changes

Descriptions will be displayed on library page.

previewed_with will be used on library page.

API changes

It is important to stay compatible with the existing structure, like what is done with ui_patterns in Drupal\ui_patterns\Definition\PatternDefinitionField:

 if (is_scalar($value)) {
      $this->definition['name'] = is_numeric($name) ? $value : $name;
      $this->definition['label'] = $value;
    }
    else {
      $this->definition['name'] = !isset($value['name']) ? $name : $value['name'];
      $this->definition['label'] = $value['label'];
      $this->definition = $value + $this->definition;
    }
Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇫🇷France pdureau Paris

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