Allow options flow to define form title/description (#4598)

* Allow options flow to define their own title

* Allow description too
This commit is contained in:
Paulus Schoutsen 2020-01-25 05:38:58 -08:00 committed by Bram Kragten
parent 6874788cc0
commit f95ba4c04c

View File

@ -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`
<ha-markdown allowsvg .content=${description}></ha-markdown>
`
: "";
},
renderShowFormStepFieldLabel(hass, step, field) {