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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Assigned: Unassigned » pdureau

pdureau’s picture

Assigned: pdureau » Unassigned
Status: Active » Needs review
grimreaper’s picture

Assigned: Unassigned » grimreaper
Related issues: +#3349067: UI Patterns library: display pattern tags
grimreaper’s picture

Assigned: grimreaper » pdureau
Status: Needs review » Needs work

Review done.

1 remark
1 question

pdureau’s picture

Assigned: pdureau » grimreaper
Status: Needs work » Needs review

Done in the same MR

  • Grimreaper committed 8e38f1d4 on 8.x-1.x authored by pdureau
    Issue #3347891 by pdureau, Grimreaper: UI Patterns Library: print tags...
grimreaper’s picture

Merged. Cherry-picking on 2.0.x

  • Grimreaper committed 1cf8c816 on 2.0.x authored by pdureau
    Issue #3347891 by pdureau, Grimreaper: UI Patterns Library: print tags...
grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.