diff --git a/bundles/org.openhab.ui.basic/src/main/java/org/openhab/ui/basic/internal/render/AbstractWidgetRenderer.java b/bundles/org.openhab.ui.basic/src/main/java/org/openhab/ui/basic/internal/render/AbstractWidgetRenderer.java index ce09d970ab..3815f99069 100644 --- a/bundles/org.openhab.ui.basic/src/main/java/org/openhab/ui/basic/internal/render/AbstractWidgetRenderer.java +++ b/bundles/org.openhab.ui.basic/src/main/java/org/openhab/ui/basic/internal/render/AbstractWidgetRenderer.java @@ -111,7 +111,7 @@ public ItemUIRegistry getItemUIRegistry() { * @return HTML code */ protected String preprocessSnippet(String originalSnippet, Widget w) { - return preprocessSnippet(originalSnippet, w, false); + return preprocessSnippet(originalSnippet, w, w.getStaticIcon() != null); } /** @@ -128,6 +128,7 @@ protected String preprocessSnippet(String originalSnippet, Widget w, boolean ign snippet = snippet.replace("%cells%", String.valueOf(12 / config.getNbColsDesktop())); snippet = snippet.replace("%cells_tablet%", String.valueOf(8 / config.getNbColsTablet())); snippet = snippet.replace("%widget_id%", itemUIRegistry.getWidgetId(w)); + snippet = snippet.replace("%icon_with_state%", Boolean.valueOf(!ignoreStateForIcon).toString()); snippet = snippet.replace("%item%", w.getItem() != null ? w.getItem() : ""); // Optimization: avoid calling 3 times itemUIRegistry.getLabel(w) String text = itemUIRegistry.getLabel(w); diff --git a/bundles/org.openhab.ui.basic/src/main/resources/snippets/buttons.html b/bundles/org.openhab.ui.basic/src/main/resources/snippets/buttons.html index 8ad90b5fd9..198a56e386 100644 --- a/bundles/org.openhab.ui.basic/src/main/resources/snippets/buttons.html +++ b/bundles/org.openhab.ui.basic/src/main/resources/snippets/buttons.html @@ -15,6 +15,7 @@ data-has-value="%has_value%" data-count="%count%" data-widget-id="%widget_id%" + data-icon-with-state="%icon_with_state%" > %buttons% diff --git a/bundles/org.openhab.ui.basic/src/main/resources/snippets/colorpicker.html b/bundles/org.openhab.ui.basic/src/main/resources/snippets/colorpicker.html index d0af3637ff..767ef95fd8 100644 --- a/bundles/org.openhab.ui.basic/src/main/resources/snippets/colorpicker.html +++ b/bundles/org.openhab.ui.basic/src/main/resources/snippets/colorpicker.html @@ -11,6 +11,7 @@ data-item="%item%" data-value="%state%" data-widget-id="%widget_id%" + data-icon-with-state="%icon_with_state%" >