UI Patterns Library: print tags by default

Created on 14 March 2023, over 1 year ago
Updated 16 May 2023, over 1 year ago

Problem/Motivation

Patterns definitions already have tags: https://git.drupalcode.org/project/ui_patterns/-/blob/8.x-1.x/src/Defini...

  /**
   * Getter.
   *
   * @return array
   *   Property value.
   */
  public function getTags() {
    return $this->definition['tags'];
  }

  /**
   * Setter.
   *
   * @param array $tags
   *   Property value.
   *
   * @return $this
   */
  public function setTags(array $tags) {
    $this->definition['tags'] = $tags;
    return $this;
  }

Tags can be added like that:

alert:
  label: "Alert"
  description: "..."
  tags: 
    - Foo
    - Bar
    - Lorem Ipsum
  fields: {}

However, tags are not printed in the pattern library.

Proposed resolution

Most of the ui patterns users are overriding patterns-meta-information.html.twig

However, it is still useful to add tags under description in the template provided by u_patterns_library:

  <p class="pattern-preview__description">{{ pattern.description }}</p>
  {% if pattern.tags %}
  <p class="pattern-preview__tags">{{ pattern.tags|join(', ') }}</p>
  {% endif %}

Just a proposal/ Not tested.

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

Production build 0.71.5 2024