Problem/Motivation

UI improvement: To be able to provide an icon to patterns used as Layout.

Proposed resolution

Remaining tasks

User interface changes

Comments

Grimreaper created an issue. See original summary.

grimreaper’s picture

duaelfr’s picture

I've been able to use the icon_map key within one pattern with UI Patterns Layout Builder.

layout_test:
  label: Layout test
  settings:
    distribution:
      type: select
      label: Distribution
      options:
        25-75: '25 / 75 %'
        33-66: '33 / 66 %'
        50-50: '50 / 50 %'
  icon_map:
    - [title]
    - [content_main, content_secondary]
  fields:
    title:
      type: string
      label: Title
      preview: 'Preview title'
    content_main:
      type: string
      label: Main content
      preview: 'Main content'
    content_secondary:
      type: string
      label: Secondary content
      preview: 'Secondary content'
  libraries:
    - layout_test:
        css:
          component:
            layout_test.css: {}

Would you want to be able to provide an icon as an image file?

pdureau’s picture

Assigned: Unassigned » grimreaper
Status: Active » Needs review

Thanks @Duaelfr tested on my project, it works!

@Grimreaper I guess this "Icon map" solution is OK, isn't it?

duaelfr’s picture

Seen during the monthly call: icon_path also allow to set a path to an icon file.
It only works on Layout Builder with UI Patterns Layout Builder.

@see ui_patterns_layout_builder_layout_alter()

grimreaper’s picture

Assigned: grimreaper » Unassigned
Category: Feature request » Support request
Status: Needs review » Fixed
StatusFileSize
new21.92 KB

Hi,

Tested with:

  icon_map:
    - [ title, toto, tutu ]
    - [ title, content_main, content_secondary ]
    - [ a, b, c, d, e ]
  icon_path: "themes/custom/ui_suite_bootstrap/screenshot.png"

Ok for me, a little bit sad that with icon_path it is not related to the pattern path or the module or theme path containing the pattern.

duaelfr’s picture

(I agree, let's open a followup :) )

pdureau’s picture

Is it possible to extend Drupal\ui_patterns\Form\PatternDisplayFormTrait to display those icons on others places?

For example, like what is done by: https://www.drupal.org/project/select_icons

grimreaper’s picture

Follow up issue created: #3345978: Be able to provide relative icon path

@pdureau: I think it would also be nice, but maybe the icon size will not be adequated. I let you create a dedicated issue for this subject.

Status: Fixed » Closed (fixed)

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