From f95ba4c04c0ebde37856ed256479116d12773544 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 25 Jan 2020 05:38:58 -0800 Subject: [PATCH] Allow options flow to define form title/description (#4598) * Allow options flow to define their own title * Allow description too --- .../config-flow/show-dialog-options-flow.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/dialogs/config-flow/show-dialog-options-flow.ts b/src/dialogs/config-flow/show-dialog-options-flow.ts index b1e22475e8..3e1b6d1742 100644 --- a/src/dialogs/config-flow/show-dialog-options-flow.ts +++ b/src/dialogs/config-flow/show-dialog-options-flow.ts @@ -44,12 +44,25 @@ export const showOptionsFlowDialog = ( : ""; }, - renderShowFormStepHeader(hass, _step) { - return hass.localize(`ui.dialogs.options_flow.form.header`); + renderShowFormStepHeader(hass, step) { + return ( + hass.localize( + `component.${step.handler}.options.step.${step.step_id}.title` + ) || hass.localize(`ui.dialogs.options_flow.form.header`) + ); }, - renderShowFormStepDescription(_hass, _step) { - return ""; + renderShowFormStepDescription(hass, step) { + const description = localizeKey( + hass.localize, + `component.${step.handler}.config.step.${step.step_id}.description`, + step.description_placeholders + ); + return description + ? html` + + ` + : ""; }, renderShowFormStepFieldLabel(hass, step, field) {