I have a custom module that registers some layouts with layout discovery, using icon_map to generate icons:
layout_panes_3c:
label: '3 Panes C'
path: layouts/panes_3c
template: layout--panes-3c
library: panes_3c
category: 'Panes: 3'
default_region: main
icon_map:
- [main]
- [left, right]
regions:
main:
label: 'Main content'
left:
label: 'Bottom left'
right:
label: 'Bottom right'
Without Panels installed, this works as intended, displaying the generated svg icon just as the layouts provided with layout_discovery do. With Panels installed, the layout_discovery layouts show the image icons provided with Panels, and my custom layouts show the "no preview icon" image.
I'm uncertain as to whether Panels and Layout Discovery are intended to be used together.
Comments
Comment #2
wrd commentedThis appears to do the trick -- it simply checks to see if getIconMap() exists and returns a non-empty value, and if so, does nothing, preventing the "no preview" icon from replacing the icon_map generated SVG. This assumes, though, that the SVG should have precedence if both it and an icon are defined.
Comment #3
wrd commentedComment #5
develissimo commentedSame issue here on Drupal 8.6.1 except that the provided patch does not solve the issue.
Layout-Icons via icon_map: ... are not generated. Instead the "no-layout-preview.png" image is shown.
Comment #6
zyyz commentedSeems to be a duplicate of https://www.drupal.org/project/panels/issues/3030976.
The patch on that issue, https://www.drupal.org/files/issues/2019-02-06/initial.patch, seems to work fine.
Comment #7
zyyz commented